Skip to content

Commit 6152d00

Browse files
praveenkumarguillaumerose
authored andcommitted
Download the golangci-lint to $GOPATH/bin
As of now if golangci-lint not available in the path then `make` execution fails. This patch will try to fetch golangci-lint to $GOPATH/bin
1 parent 6dd0a38 commit 6152d00

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Go and compilation related variables
22
BUILD_DIR ?= out
3+
GOPATH ?= $(shell go env GOPATH)
34

45
ORG := github.com/machine-drivers
56
REPOPATH ?= $(ORG)/docker-machine-driver-hyperkit
7+
GOLANGCI_LINT_VERSION=v1.39.0
68

79
default: build
810

@@ -27,9 +29,15 @@ build: $(BUILD_DIR) vendor lint test
2729
-o $(BUILD_DIR)/crc-driver-hyperkit
2830
chmod +x $(BUILD_DIR)/crc-driver-hyperkit
2931

32+
.PHONY: golangci-lint
33+
golangci-lint:
34+
@if $(GOPATH)/bin/golangci-lint version 2>&1 | grep -vq $(GOLANGCI_LINT_VERSION); then\
35+
pushd /tmp && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) && popd; \
36+
fi
37+
3038
.PHONY: lint
31-
lint:
32-
golangci-lint run
39+
lint: golangci-lint
40+
$(GOPATH)/bin/golangci-lint run
3341

3442
.PHONY: test
3543
test:

0 commit comments

Comments
 (0)