File tree Expand file tree Collapse file tree 4 files changed +41
-13
lines changed Expand file tree Collapse file tree 4 files changed +41
-13
lines changed Original file line number Diff line number Diff line change 18
18
steps :
19
19
- uses : actions/checkout@v4
20
20
- uses : actions/setup-python@v5
21
+ - uses : actions/setup-go@v5
22
+ with :
23
+ go-version : ' stable'
21
24
-
uses :
pre-commit/[email protected]
Original file line number Diff line number Diff line change @@ -50,7 +50,12 @@ repos:
50
50
- id : markdown-link-check
51
51
exclude : ^(vendor)
52
52
53
- - repo : https://github.com/golangci/golangci-lint
54
- rev : v1.60.1
53
+ - repo : local
55
54
hooks :
56
55
- id : golangci-lint
56
+ name : golangci-lint
57
+ language : system
58
+ types : [go]
59
+ require_serial : true
60
+ pass_filenames : false
61
+ entry : etc/golangci-lint.sh
Original file line number Diff line number Diff line change 70
70
fmt :
71
71
go fmt ./...
72
72
73
- .PHONY : install-golangci-lint
74
- install-golangci-lint :
75
- go install github.com/golangci/golangci-lint/cmd/
[email protected]
76
-
77
73
# Lint with various GOOS and GOARCH targets to catch static analysis failures that may only affect
78
74
# specific operating systems or architectures. For example, staticcheck will only check for 64-bit
79
75
# alignment of atomically accessed variables on 32-bit architectures (see
80
76
# https://staticcheck.io/docs/checks#SA1027)
81
77
.PHONY : lint
82
- lint : install-golangci-lint
83
- GOOS=linux GOARCH=386 golangci-lint run --config .golangci.yml ./...
84
- GOOS=linux GOARCH=arm golangci-lint run --config .golangci.yml ./...
85
- GOOS=linux GOARCH=arm64 golangci-lint run --config .golangci.yml ./...
86
- GOOS=linux GOARCH=amd64 golangci-lint run --config .golangci.yml ./...
87
- GOOS=linux GOARCH=ppc64le golangci-lint run --config .golangci.yml ./...
88
- GOOS=linux GOARCH=s390x golangci-lint run --config .golangci.yml ./...
78
+ lint :
79
+ GOOS=linux GOARCH=386 etc/ golangci-lint.sh
80
+ GOOS=linux GOARCH=arm etc/ golangci-lint.sh
81
+ GOOS=linux GOARCH=arm64 etc/ golangci-lint.sh
82
+ GOOS=linux GOARCH=amd64 etc/ golangci-lint.sh
83
+ GOOS=linux GOARCH=ppc64le etc/ golangci-lint.sh
84
+ GOOS=linux GOARCH=s390x etc/ golangci-lint.sh
89
85
90
86
.PHONY : update-notices
91
87
update-notices :
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -ex
3
+
4
+ # Keep this in sync with go version used in static-analysis Evergreen build variant.
5
+ GO_VERSION=1.22.8
6
+ GOLANGCI_LINT_VERSION=1.60.1
7
+
8
+ # Unset the cross-compiler overrides while downloading binaries.
9
+ GOOS_ORIG=${GOOS:- }
10
+ export GOOS=
11
+ GOARCH_ORIG=${GOARCH:- }
12
+ export GOARCH=
13
+
14
+ go install golang.org/dl/go$GO_VERSION @latest
15
+ go${GO_VERSION} download
16
+ GOROOT=" $( go${GO_VERSION} env GOROOT) "
17
+ PATH=" $GOROOT /bin:$PATH "
18
+ export PATH
19
+ export GOROOT
20
+ go install github.com/golangci/golangci-lint/cmd/golangci-lint@v${GOLANGCI_LINT_VERSION}
21
+
22
+ export GOOS=$GOOS_ORIG
23
+ export GOARCH=$GOARCH_ORIG
24
+ golangci-lint run --config .golangci.yml ./...
You can’t perform that action at this time.
0 commit comments