Skip to content

Commit d0ca515

Browse files
authored
use project toolchain for go run tools (#3709)
ensure go run tools use project toolchain
1 parent 83d702b commit d0ca515

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
GOVERSION ?= $(shell go env GOVERSION)
2+
13
## help: 💡 Display available commands
24
.PHONY: help
35
help:
@@ -9,7 +11,7 @@ help:
911
audit:
1012
go mod verify
1113
go vet ./...
12-
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
14+
GOTOOLCHAIN=$(GOVERSION) go run golang.org/x/vuln/cmd/govulncheck@latest ./...
1315

1416
## benchmark: 📈 Benchmark code performance
1517
.PHONY: benchmark
@@ -19,13 +21,13 @@ benchmark:
1921
## coverage: ☂️ Generate coverage report
2022
.PHONY: coverage
2123
coverage:
22-
go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=1 -coverprofile=/tmp/coverage.out -covermode=atomic
24+
GOTOOLCHAIN=$(GOVERSION) go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=1 -coverprofile=/tmp/coverage.out -covermode=atomic
2325
go tool cover -html=/tmp/coverage.out
2426

2527
## format: 🎨 Fix code format issues
2628
.PHONY: format
2729
format:
28-
go run mvdan.cc/gofumpt@latest -w -l .
30+
GOTOOLCHAIN=$(GOVERSION) go run mvdan.cc/gofumpt@latest -w -l .
2931

3032
## markdown: 🎨 Find markdown format issues (Requires markdownlint-cli2)
3133
.PHONY: markdown
@@ -47,17 +49,17 @@ install-lint:
4749
## modernize: 🛠 Run gopls modernize
4850
.PHONY: modernize
4951
modernize:
50-
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test=false ./...
52+
GOTOOLCHAIN=$(GOVERSION) go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test=false ./...
5153

5254
## test: 🚦 Execute all tests
5355
.PHONY: test
5456
test:
55-
go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=1 -shuffle=on
57+
GOTOOLCHAIN=$(GOVERSION) go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=1 -shuffle=on
5658

5759
## longtest: 🚦 Execute all tests 10x
5860
.PHONY: longtest
5961
longtest:
60-
go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=15 -shuffle=on
62+
GOTOOLCHAIN=$(GOVERSION) go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=15 -shuffle=on
6163

6264
## tidy: 📌 Clean and tidy dependencies
6365
.PHONY: tidy
@@ -67,7 +69,7 @@ tidy:
6769
## betteralign: 📐 Optimize alignment of fields in structs
6870
.PHONY: betteralign
6971
betteralign:
70-
go run github.com/dkorunic/betteralign/cmd/betteralign@latest -test_files -generated_files -apply ./...
72+
GOTOOLCHAIN=$(GOVERSION) go run github.com/dkorunic/betteralign/cmd/betteralign@v0.7.2 -test_files -generated_files -apply ./...
7173

7274
## generate: ⚡️ Generate msgp && interface implementations
7375
.PHONY: generate

0 commit comments

Comments
 (0)