There was recent work to add global values for `env`, `flags`, and `ldflags`. The global values would be merged with per-build values to generate the value used for the builds.
There are a couple issues with this:
- It's inconsistent with the existing code, which only has `default` values declared globally (there is no merging today).
- The name of the `flag` variable, caused a conflict with knative's `KO_FLAGS` environment variable (see #1317)
This PR does the following:
- Refactors the logic to use `defaultEnv`, `defaultFlags`, and `defaultLdflags`. This resolves both issues described above.
- Updates documentation
Fixes#1317
This restructures the build logic in order to expand the buildArgs to include:
- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.
Fixes#1301
Signed-off-by: Nathan Mittler <nmittler@aviatrix.com>
This includes a number of template parameters supported by [goreleaser](https://goreleaser.com/customization/templates/). Specifically, the build date information and the majority of the Git params.
Majority of the code is copied from goreleaser. I've added the MIT license from goreleaser at the top of the files.
Fixes#493
Signed-off-by: Nathan Mittler <nmittler@aviatrix.com>
Supports configuring global `env` variables that will be applied to all builds.
Modifies the `builder` function to accept a `buildContext` structure. This will simplify similar modifications in the future.
Fixes#1305
Signed-off-by: Nathan Mittler <nmittler@aviatrix.com>