Merge pull request #8451 from hashicorp/f-specify-ldflags-from-env-vars

Allow specifying ldflags via env vars
This commit is contained in:
Jake Champlin 2016-08-25 10:34:47 -04:00 committed by GitHub
commit c2a0d29955
2 changed files with 3 additions and 2 deletions

View File

@ -77,7 +77,7 @@ vet:
# generate runs `go generate` to build the dynamically generated # generate runs `go generate` to build the dynamically generated
# source files. # source files.
generate: generate:
@which stringer ; if [ $$? -ne 0 ]; then \ @which stringer > /dev/null; if [ $$? -ne 0 ]; then \
go get -u golang.org/x/tools/cmd/stringer; \ go get -u golang.org/x/tools/cmd/stringer; \
fi fi
go generate $$(go list ./... | grep -v /terraform/vendor/) go generate $$(go list ./... | grep -v /terraform/vendor/)

View File

@ -39,7 +39,8 @@ fi
# instruct gox to build statically linked binaries # instruct gox to build statically linked binaries
export CGO_ENABLED=0 export CGO_ENABLED=0
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY}" # Allow LD_FLAGS to be appended during development compilations
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} $LD_FLAGS"
# In relase mode we don't want debug information in the binary # In relase mode we don't want debug information in the binary
if [[ -n "${TF_RELEASE}" ]]; then if [[ -n "${TF_RELEASE}" ]]; then
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -s -w" LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -s -w"