Skip to content

Commit c46fb7a

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 actions to latest versions (checkout@v4, setup-go@v5) - Update golangci-lint action to v7 and version to v2.6 - Migrate golangci-lint config from v1 to v2 format - Fix embedded field selector lint warning
1 parent 55eef96 commit c46fb7a

3 files changed

Lines changed: 93 additions & 104 deletions

File tree

.github/workflows/ci.yml

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

1313
steps:
14-
- name: set up go 1.22
15-
uses: actions/setup-go@v4
14+
- name: checkout
15+
uses: actions/checkout@v4
16+
17+
- name: set up go
18+
uses: actions/setup-go@v5
1619
with:
1720
go-version: "1.22"
1821
id: go
1922

20-
- name: checkout
21-
uses: actions/checkout@v3
22-
2323
- name: build and test
2424
run: |
2525
go get -v
@@ -30,9 +30,9 @@ jobs:
3030
TZ: "America/Chicago"
3131

3232
- name: golangci-lint
33-
uses: golangci/golangci-lint-action@v3
33+
uses: golangci/golangci-lint-action@v7
3434
with:
35-
version: v1.61
35+
version: v2.6
3636

3737
- name: install goveralls
3838
run: go install github.com/mattn/goveralls@latest

.golangci.yml

Lines changed: 85 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,92 @@
1-
linters-settings:
2-
govet:
3-
shadow: true
4-
golint:
5-
min-confidence: 0.6
6-
gocyclo:
7-
min-complexity: 15
8-
maligned:
9-
suggest-new: true
10-
dupl:
11-
threshold: 100
12-
goconst:
13-
min-len: 2
14-
min-occurrences: 2
15-
misspell:
16-
locale: US
17-
lll:
18-
line-length: 140
19-
gocritic:
20-
enabled-tags:
21-
- performance
22-
- style
23-
- experimental
24-
disabled-checks:
25-
- wrapperFunc
26-
- hugeParam
27-
- rangeValCopy
28-
1+
version: "2"
2+
run:
3+
concurrency: 4
294
linters:
30-
disable-all: true
5+
default: none
316
enable:
32-
- revive
33-
- govet
34-
- unconvert
35-
- gosec
36-
- unparam
37-
- unused
38-
- typecheck
39-
- ineffassign
40-
- stylecheck
417
- gochecknoinits
428
- gocritic
9+
- gosec
10+
- govet
11+
- ineffassign
4312
- nakedret
44-
- gosimple
4513
- prealloc
14+
- revive
15+
- staticcheck
16+
- unconvert
17+
- unparam
18+
- unused
19+
settings:
20+
goconst:
21+
min-len: 2
22+
min-occurrences: 2
23+
gocritic:
24+
disabled-checks:
25+
- wrapperFunc
26+
- hugeParam
27+
- rangeValCopy
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+
lll:
39+
line-length: 140
40+
misspell:
41+
locale: US
4642

47-
fast: false
48-
49-
50-
run:
51-
concurrency: 4
52-
53-
issues:
54-
exclude-dirs:
55-
- vendor
56-
exclude-rules:
57-
- text: "should have a package comment, unless it's in another file for this package"
58-
linters:
59-
- golint
60-
- text: "exitAfterDefer:"
61-
linters:
62-
- gocritic
63-
- text: "whyNoLint: include an explanation for nolint directive"
64-
linters:
65-
- gocritic
66-
- text: "go.mongodb.org/mongo-driver/bson/primitive.E"
67-
linters:
68-
- govet
69-
- text: "weak cryptographic primitive"
70-
linters:
71-
- gosec
72-
- text: "integer overflow conversion"
73-
linters:
74-
- gosec
75-
- text: "should have a package comment"
76-
linters:
77-
- revive
78-
- text: "at least one file in a package should have a package comment"
79-
linters:
80-
- stylecheck
81-
- text: "commentedOutCode: may want to remove commented-out code"
82-
linters:
83-
- gocritic
84-
- text: "unnamedResult: consider giving a name to these results"
85-
linters:
86-
- gocritic
87-
- text: "var-naming: don't use an underscore in package name"
88-
linters:
89-
- revive
90-
- text: "should not use underscores in package names"
91-
linters:
92-
- stylecheck
93-
- text: "struct literal uses unkeyed fields"
94-
linters:
95-
- govet
96-
- linters:
97-
- unparam
98-
- unused
99-
- revive
100-
path: _test\.go$
101-
text: "unused-parameter"
102-
exclude-use-default: false
103-
43+
exclusions:
44+
generated: lax
45+
rules:
46+
- linters:
47+
- gocritic
48+
text: "exitAfterDefer:"
49+
- linters:
50+
- gocritic
51+
text: "whyNoLint: include an explanation for nolint directive"
52+
- linters:
53+
- govet
54+
text: "go.mongodb.org/mongo-driver/bson/primitive.E"
55+
- linters:
56+
- gosec
57+
text: "weak cryptographic primitive"
58+
- linters:
59+
- gosec
60+
text: "integer overflow conversion"
61+
- linters:
62+
- revive
63+
text: "should have a package comment"
64+
- linters:
65+
- staticcheck
66+
text: "at least one file in a package should have a package comment"
67+
- linters:
68+
- gocritic
69+
text: "commentedOutCode: may want to remove commented-out code"
70+
- linters:
71+
- gocritic
72+
text: "unnamedResult: consider giving a name to these results"
73+
- linters:
74+
- revive
75+
text: "var-naming: don't use an underscore in package name"
76+
- linters:
77+
- staticcheck
78+
text: "should not use underscores in package names"
79+
- linters:
80+
- govet
81+
text: "struct literal uses unkeyed fields"
82+
- linters:
83+
- unparam
84+
- unused
85+
- revive
86+
path: _test\.go$
87+
text: "unused-parameter"
88+
paths:
89+
- vendor
90+
- third_party$
91+
- builtin$
92+
- examples$

sizedgroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type SizedGroup struct {
1717
// NewSizedGroup makes wait group with limited size alive goroutines
1818
func NewSizedGroup(size int, opts ...GroupOption) *SizedGroup {
1919
res := SizedGroup{sema: NewSemaphore(size)}
20-
res.options.ctx = context.Background()
20+
res.ctx = context.Background()
2121
for _, opt := range opts {
2222
opt(&res.options)
2323
}

0 commit comments

Comments
 (0)