@@ -49,23 +49,23 @@ endif
49
49
GOTEST := $(GO) test
50
50
GOTEST_DIR :=
51
51
ifneq ($(CIRCLE_JOB),)
52
- ifneq ($(shell command -v gotestsum > /dev/null),)
52
+ ifneq ($(shell command -v gotestsum 2 > /dev/null),)
53
53
GOTEST_DIR := test-results
54
54
GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
55
55
endif
56
56
endif
57
57
58
- PROMU_VERSION ?= 0.15 .0
58
+ PROMU_VERSION ?= 0.17 .0
59
59
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
60
60
61
61
SKIP_GOLANGCI_LINT :=
62
62
GOLANGCI_LINT :=
63
63
GOLANGCI_LINT_OPTS ?=
64
- GOLANGCI_LINT_VERSION ?= v1.55 .2
65
- # golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
64
+ GOLANGCI_LINT_VERSION ?= v1.60 .2
65
+ # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64 .
66
66
# windows isn't included here because of the path separator being different.
67
67
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
68
- ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
68
+ ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386 arm64 ))
69
69
# If we're in CI and there is an Actions file, that means the linter
70
70
# is being run in Actions, so we don't need to run it here.
71
71
ifneq (,$(SKIP_GOLANGCI_LINT))
@@ -169,16 +169,20 @@ common-vet:
169
169
common-lint: $(GOLANGCI_LINT)
170
170
ifdef GOLANGCI_LINT
171
171
@echo ">> running golangci-lint"
172
- # 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
173
- # Otherwise staticcheck might fail randomly for some reason not yet explained.
174
- $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
175
172
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
176
173
endif
177
174
175
+ .PHONY: common-lint-fix
176
+ common-lint-fix: $(GOLANGCI_LINT)
177
+ ifdef GOLANGCI_LINT
178
+ @echo ">> running golangci-lint fix"
179
+ $(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_OPTS) $(pkgs)
180
+ endif
181
+
178
182
.PHONY: common-yamllint
179
183
common-yamllint:
180
184
@echo ">> running yamllint on all YAML files in the repository"
181
- ifeq (, $(shell command -v yamllint > /dev/null))
185
+ ifeq (, $(shell command -v yamllint 2 > /dev/null))
182
186
@echo "yamllint not installed so skipping"
183
187
else
184
188
yamllint .
@@ -204,6 +208,10 @@ common-tarball: promu
204
208
@echo ">> building release tarball"
205
209
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
206
210
211
+ .PHONY: common-docker-repo-name
212
+ common-docker-repo-name:
213
+ @echo "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"
214
+
207
215
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
208
216
common-docker: $(BUILD_DOCKER_ARCHS)
209
217
$(BUILD_DOCKER_ARCHS): common-docker-%:
@@ -267,3 +275,9 @@ $(1)_precheck:
267
275
exit 1; \
268
276
fi
269
277
endef
278
+
279
+ govulncheck: install-govulncheck
280
+ govulncheck ./...
281
+
282
+ install-govulncheck:
283
+ command -v govulncheck > /dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest
0 commit comments