Skip to content

Commit 3ca7423

Browse files
vdemeestertekton-robot
authored andcommitted
Makefile: install golangci-lint version from tools/go.mod
And "version" the binary so we *ensure* that it doesn't execute an older version of `golangci-lint` when we update the dependency. Signed-off-by: Vincent Demeester <[email protected]>
1 parent 9bdb19a commit 3ca7423

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ TESTPKGS = $(shell env GO111MODULE=on $(GO) list -f \
99
BIN = $(CURDIR)/.bin
1010
WOKE ?= go run -modfile go.mod github.com/get-woke/woke
1111

12-
GOLANGCI_VERSION = v1.59.1
12+
# Get golangci_version from tools/go.mod
13+
GOLANGCI_VERSION := $(shell cat tools/go.mod | grep golangci-lint | awk '{ print $$3 }')
1314
WOKE_VERSION = v0.19.0
1415

1516
GO = go
@@ -164,9 +165,10 @@ $(BIN)/errcheck: PACKAGE=github.com/kisielk/errcheck
164165
errcheck: | $(ERRCHECK) ; $(info $(M) running errcheck…) ## Run errcheck
165166
$Q $(ERRCHECK) ./...
166167

167-
GOLANGCILINT = $(BIN)/golangci-lint
168-
$(BIN)/golangci-lint: ; $(info $(M) getting golangci-lint $(GOLANGCI_VERSION))
169-
cd tools; GOBIN=$(BIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_VERSION)
168+
GOLANGCILINT = $(BIN)/golangci-lint-$(GOLANGCI_VERSION)
169+
$(BIN)/golangci-lint-$(GOLANGCI_VERSION): ; $(info $(M) getting golangci-lint $(GOLANGCI_VERSION))
170+
cd tools; go mod download github.com/golangci/golangci-lint && go mod tidy
171+
cd tools; go build -o $(BIN)/golangci-lint-$(GOLANGCI_VERSION) github.com/golangci/golangci-lint/cmd/golangci-lint
170172

171173
.PHONY: golangci-lint
172174
golangci-lint: | $(GOLANGCILINT) ; $(info $(M) running golangci-lint…) @ ## Run golangci-lint

tools/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/tektoncd/pipeline/tools
22

3-
go 1.18
3+
go 1.22
44

55
require github.com/golangci/golangci-lint v1.59.1
66

tools/go.sum

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)