Skip to content

Commit 3d8d086

Browse files
committed
feat: add golangci-lint-action to the lint workflow
1 parent 22d080b commit 3d8d086

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

.github/workflows/lint.yaml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,9 @@ jobs:
1717
- name: Set up Go
1818
uses: actions/setup-go@v5
1919
with:
20-
go-version-file: 'go.mod'
20+
go-version-file: "go.mod"
2121

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

0 commit comments

Comments
 (0)