Skip to content

Commit 95e338f

Browse files
committed
Fix CI workflow: checkout before setup-go for proper caching
- Move checkout step before setup-go to enable Go module caching - setup-go needs go.mod/go.sum files to generate cache keys - Update golangci-lint action to v7 and version to v2.6 - Migrate golangci-lint config from v1 to v2 format
1 parent d8463dd commit 95e338f

File tree

2 files changed

+55
-53
lines changed

2 files changed

+55
-53
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- name: set up go 1.23
14+
- name: checkout
15+
uses: actions/checkout@v4
16+
17+
- name: set up go
1518
uses: actions/setup-go@v5
1619
with:
1720
go-version: "1.23"
@@ -22,9 +25,6 @@ jobs:
2225
with:
2326
mongoDBVersion: "5.0"
2427

25-
- name: checkout
26-
uses: actions/checkout@v4
27-
2828
- name: build and test
2929
run: |
3030
export TZ="America/Chicago"
@@ -34,9 +34,9 @@ jobs:
3434
cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "_mock.go" > $GITHUB_WORKSPACE/profile.cov
3535
3636
- name: golangci-lint
37-
uses: golangci/golangci-lint-action@v6
37+
uses: golangci/golangci-lint-action@v7
3838
with:
39-
version: latest
39+
version: v2.6
4040

4141
- name: submit coverage
4242
run: |

.golangci.yml

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,57 @@
1-
linters-settings:
2-
govet:
3-
enable:
4-
- shadow
5-
gocyclo:
6-
min-complexity: 15
7-
dupl:
8-
threshold: 100
9-
misspell:
10-
locale: US
11-
gocritic:
12-
enabled-tags:
13-
- performance
14-
- style
15-
- experimental
16-
disabled-checks:
17-
- wrapperFunc
18-
- hugeParam
19-
1+
version: "2"
2+
run:
3+
concurrency: 4
204
linters:
5+
default: none
216
enable:
22-
- revive
23-
- govet
24-
- unconvert
25-
- staticcheck
26-
- unused
27-
- gosec
28-
- gocyclo
297
- dupl
30-
- misspell
31-
- unparam
32-
- typecheck
33-
- ineffassign
34-
- stylecheck
358
- gochecknoinits
36-
- copyloopvar
379
- gocritic
10+
- gocyclo
11+
- govet
12+
- ineffassign
13+
- misspell
3814
- nakedret
39-
- gosimple
4015
- prealloc
41-
fast: false
42-
disable-all: true
16+
- revive
17+
- staticcheck
18+
- unconvert
19+
- unparam
20+
- unused
21+
settings:
22+
dupl:
23+
threshold: 100
24+
gocritic:
25+
disabled-checks:
26+
- wrapperFunc
27+
- hugeParam
28+
enabled-tags:
29+
- performance
30+
- style
31+
- experimental
32+
gocyclo:
33+
min-complexity: 15
34+
govet:
35+
enable-all: true
36+
disable:
37+
- fieldalignment
38+
misspell:
39+
locale: US
4340

44-
issues:
45-
exclude-rules:
46-
- text: "at least one file in a package should have a package comment"
47-
linters:
48-
- stylecheck
49-
- text: "composites: go.mongodb.org/mongo-driver/bson/primitive.E struct literal uses unkeyed fields"
50-
linters:
51-
- govet
52-
- text: "package-comments: should have a package comment"
53-
linters:
54-
- revive
55-
exclude-use-default: false
41+
exclusions:
42+
generated: lax
43+
rules:
44+
- linters:
45+
- staticcheck
46+
text: "at least one file in a package should have a package comment"
47+
- linters:
48+
- govet
49+
text: "composites: go.mongodb.org/mongo-driver/bson/primitive.E struct literal uses unkeyed fields"
50+
- linters:
51+
- revive
52+
text: "package-comments: should have a package comment"
53+
paths:
54+
- vendor
55+
- third_party$
56+
- builtin$
57+
- examples$

0 commit comments

Comments
 (0)