-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (36 loc) · 1.03 KB
/
linting.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
name: linting
on:
pull_request:
push:
branches: [main]
jobs:
ci:
name: "run linting"
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"]
go: ["1.23.x"]
runs-on: ${{ matrix.os }}
steps:
- name: "checkout"
uses: actions/checkout@v4
- name: "fetch unshallow"
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: "fmt"
run: if [ "$(go fmt ./... | wc -l)" -gt 0 ]; then echo "go fmt failed, please run again locally"; exit 1; fi
- name: "vet"
run: "go vet ./..."
- name: "setup imports"
run: "go install golang.org/x/tools/cmd/goimports@latest"
- name: "test imports"
run: if [ "$(goimports -l . | wc -l)" -gt 0 ]; then echo "goimports failed, please run again locally"; exit 1; fi
- name: "setup staticcheck"
run: "go install honnef.co/go/tools/cmd/staticcheck@latest"
- name: staticcheck
run: "staticcheck ./..."