Skip to content

Commit

Permalink
Makefile: install golangci-lint version from tools/go.mod
Browse files Browse the repository at this point in the history
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 <vdemeest@redhat.com>
  • Loading branch information
vdemeester authored and tekton-robot committed Jun 18, 2024
1 parent 9bdb19a commit 3ca7423
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ TESTPKGS = $(shell env GO111MODULE=on $(GO) list -f \
BIN = $(CURDIR)/.bin
WOKE ?= go run -modfile go.mod github.com/get-woke/woke

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

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

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

.PHONY: golangci-lint
golangci-lint: | $(GOLANGCILINT) ; $(info $(M) running golangci-lint…) @ ## Run golangci-lint
Expand Down
2 changes: 1 addition & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tektoncd/pipeline/tools

go 1.18
go 1.22

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

Expand Down
19 changes: 19 additions & 0 deletions tools/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ca7423

Please sign in to comment.