|
17 | 17 | -name:Set up Go
|
18 | 18 | uses:actions/setup-go@v5
|
19 | 19 | with:
|
20 |
| -go-version-file:'go.mod' |
| 20 | +go-version-file:"go.mod" |
21 | 21 |
|
22 |
| - -name:Verify dependencies |
23 |
| -run:| |
24 |
| - go mod verify |
25 |
| - go mod download |
26 |
| -
|
27 |
| - LINT_VERSION=2.1.6 |
28 |
| - curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \ |
29 |
| - tar xz --strip-components 1 --wildcards \*/golangci-lint |
30 |
| - mkdir -p bin && mv golangci-lint bin/ |
31 |
| -
|
32 |
| - -name:Run checks |
33 |
| -run:| |
34 |
| - STATUS=0 |
35 |
| - assert-nothing-changed() { |
36 |
| - local diff |
37 |
| - "$@" >/dev/null || return 1 |
38 |
| - if ! diff="$(git diff -U1 --color --exit-code)"; then |
39 |
| - printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2 |
40 |
| - git checkout -- . |
41 |
| - STATUS=1 |
42 |
| - fi |
43 |
| - } |
44 |
| -
|
45 |
| - assert-nothing-changed go fmt ./... |
46 |
| - assert-nothing-changed go mod tidy |
47 |
| -
|
48 |
| - bin/golangci-lint run --timeout=3m || STATUS=$? |
49 |
| -
|
50 |
| - exit $STATUS |
| 22 | + -name:golangci-lint |
| 23 | +uses:golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 |
| 24 | +with: |
| 25 | +version:v2.1.6 |