Makefile: make add EXTRA_GOFLAG to GOFLAGS (#605)
continuous-integration/drone/push Build is passing Details

Makefile: make add EXTRA_GOFLAG to GOFLAGS

Some commands (`go generate`) only support taking `GOFLAGS` from the environment
but setting `GOFLAGS` environment variable is ineffectual because the variable
of the same name defined in the Makefile shadows it.

We also have a custom `EXTRA_GOFLAGS` variable but we only pass that to `go build`.

Let’s add `EXTRA_GOFLAGS` to the `GOFLAGS` variable in the Makefile to allow passing
custom flags to Go through `EXTRA_GOFLAGS` environment variable.

Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
Reviewed-on: vikunja/api#605
Reviewed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
jtojnar 2020-07-04 16:55:45 +00:00 committed by konrad
parent ae12871bd7
commit 158d98c2bd
1 changed files with 2 additions and 2 deletions

View File

@ -16,8 +16,8 @@ endif
GOFILES := $(shell find . -name "*.go" -type f ! -path "*/bindata.go")
GOFMT ?= gofmt -s
GOFLAGS := -v
EXTRA_GOFLAGS ?=
GOFLAGS := -v $(EXTRA_GOFLAGS)
LDFLAGS := -X "code.vikunja.io/api/pkg/version.Version=$(shell git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')" -X "main.Tags=$(TAGS)"
@ -105,7 +105,7 @@ generate:
go generate code.vikunja.io/api/pkg/static
$(EXECUTABLE): $(SOURCES)
go build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
go build $(GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
.PHONY: compress-build
compress-build: