Skip to content

Commit c9b07d8

Browse files
committed
chore: update linter
1 parent bb51985 commit c9b07d8

File tree

4 files changed

+36
-39
lines changed

4 files changed

+36
-39
lines changed

.github/workflows/lint.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
name: golangci-lint
2+
23
on:
34
push:
45
branches:
56
- main
6-
- master
77
pull_request:
8+
branches:
9+
- main
810

911
permissions:
1012
contents: read
1113

1214
env:
13-
GOLANGCI_LINT_VERSION: v1.61
15+
GOLANGCI_LINT_VERSION: v2.0
1416
CGO_ENABLED: 0
1517

1618
jobs:
@@ -35,6 +37,6 @@ jobs:
3537
git diff --exit-code go.sum
3638
3739
- name: golangci-lint
38-
uses: golangci/golangci-lint-action@v6
40+
uses: golangci/golangci-lint-action@v7
3941
with:
4042
version: ${{ env.GOLANGCI_LINT_VERSION }}

.github/workflows/tests.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: Tests
2+
23
on:
34
push:
45
branches:
56
- main
6-
- master
77
pull_request:
8+
branches:
9+
- main
810

911
permissions:
1012
contents: read

.golangci.yml

+26-34
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1+
version: "2"
2+
3+
formatters:
4+
enable:
5+
- gci
6+
- gofumpt
7+
18
linters:
2-
disable-all: true
9+
default: none
310
enable:
411
- asasalint
512
- asciicheck
613
- bidichk
714
- containedctx
815
- contextcheck
9-
# - copyloopvar
16+
- copyloopvar
1017
- cyclop
1118
- dogsled
1219
- dupl
@@ -19,7 +26,6 @@ linters:
1926
- fatcontext
2027
- forbidigo
2128
- funlen
22-
- gci
2329
- gocheckcompilerdirectives
2430
- gochecknoglobals
2531
- gochecknoinits
@@ -29,20 +35,16 @@ linters:
2935
- gocyclo
3036
- godot
3137
- godox
32-
- gofmt
33-
- gofumpt
34-
- goimports
3538
- gomoddirectives
3639
- gomodguard
3740
- goprintffuncname
3841
- gosec
39-
- gosimple
4042
- govet
4143
- importas
4244
- inamedparam
4345
- ineffassign
4446
- interfacebloat
45-
# - intrange
47+
- intrange
4648
- ireturn
4749
- loggercheck
4850
- maintidx
@@ -61,10 +63,8 @@ linters:
6163
- reassign
6264
- revive
6365
- staticcheck
64-
- stylecheck
6566
- tagalign
6667
- tagliatelle
67-
- tenv
6868
- testableexamples
6969
- testifylint
7070
- thelper
@@ -78,31 +78,23 @@ linters:
7878
- wrapcheck
7979
- wsl
8080

81-
linters-settings:
82-
stylecheck:
83-
checks: ['*', '-ST1000']
84-
cyclop:
85-
max-complexity: 15
81+
settings:
82+
cyclop:
83+
max-complexity: 15
84+
staticcheck:
85+
checks:
86+
- '*'
87+
- -ST1000
88+
exclusions:
89+
warn-unused: true
90+
presets:
91+
- comments
92+
rules:
93+
- linters:
94+
- gochecknoglobals
95+
path: pkg/analyzer/analyzer.go
96+
text: Analyzer is a global variable
8697

8798
issues:
88-
exclude-use-default: false
8999
max-issues-per-linter: 0
90100
max-same-issues: 0
91-
exclude-rules:
92-
- linters:
93-
- revive
94-
text: "package-comments: should have a package comment"
95-
- linters:
96-
- revive
97-
text: "exported: .+ should have comment or be unexported"
98-
- path: pkg/analyzer/analyzer.go
99-
linters:
100-
- gochecknoglobals
101-
text: "Analyzer is a global variable"
102-
103-
output:
104-
show-stats: true
105-
sort-results: true
106-
sort-order:
107-
- linter
108-
- file

pkg/analyzer/analyzer.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ func run(pass *analysis.Pass) (interface{}, error) {
4444
return
4545
}
4646

47-
if formatParamNames := params[len(params)-2].Names; len(formatParamNames) == 0 || formatParamNames[len(formatParamNames)-1].Name != "format" {
47+
formatParamNames := params[len(params)-2].Names
48+
if len(formatParamNames) == 0 || formatParamNames[len(formatParamNames)-1].Name != "format" {
4849
return
4950
}
5051

0 commit comments

Comments
 (0)