Makefile: Allow $(GO) to be set with environmental variable (#2919)
* promu: Use same go invocation as prometheus' for building If you override $(GO) var in prometheus Makefile in order to use a custom go binary you might encounter errors while building promu as promu's Makefile $(GO) var is also defined to look for go in the $PATH and you might end up using different go binaries for building prometheus and promu. This patch makes prometheus Makefile pass its $(GO) var to promu's makefile as environmental variable. Signed-off-by: Sylvain Rabot <s.rabot@lectra.com> * Makefile: Allow $(GO) to be set with environmental variable Signed-off-by: Sylvain Rabot <s.rabot@lectra.com> * Makefile: Fix hardcoded call to gofmt Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
This commit is contained in:
parent
e3b926c03b
commit
db5b1aa5f6
6
Makefile
6
Makefile
|
@ -11,7 +11,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
GO := GO15VENDOREXPERIMENT=1 go
|
||||
GO ?= GO15VENDOREXPERIMENT=1 go
|
||||
GOFMT ?= $(GO)fmt
|
||||
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
|
||||
PROMU := $(FIRST_GOPATH)/bin/promu
|
||||
STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck
|
||||
|
@ -39,7 +40,7 @@ all: format staticcheck build test
|
|||
|
||||
style:
|
||||
@echo ">> checking code style"
|
||||
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
|
||||
@! $(GOFMT) -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
|
||||
|
||||
check_license:
|
||||
@echo ">> checking license header"
|
||||
|
@ -88,6 +89,7 @@ promu:
|
|||
@echo ">> fetching promu"
|
||||
@GOOS=$(shell uname -s | tr A-Z a-z) \
|
||||
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
|
||||
GO="$(GO)" \
|
||||
$(GO) get -u github.com/prometheus/promu
|
||||
|
||||
$(FIRST_GOPATH)/bin/staticcheck:
|
||||
|
|
Loading…
Reference in New Issue