Skip to content

Commit a5339b3

Browse files
authored
Go1.25 (#65)
* Go 1.24 * Go 1.25 * Remove task:install and separate fmt tools * checkout@v4 everywhere * more revive rules
1 parent f952d2c commit a5339b3

File tree

6 files changed

+125
-43
lines changed

6 files changed

+125
-43
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
branches: [ master ]
99

1010
env:
11-
GO_VERSION: ^1.24
12-
GOLANGCI_LINT_VERSION: v1.64.7
11+
GO_VERSION: ^1.25
12+
GOLANGCI_LINT_VERSION: v2.4.0
1313

1414
permissions:
1515
contents: read
@@ -33,11 +33,11 @@ jobs:
3333
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
3434
runs-on: ubuntu-latest
3535
steps:
36-
- uses: actions/checkout@v4
36+
- uses: actions/checkout@v5
3737
- uses: actions/setup-go@v5
3838
with:
3939
go-version: ${{ env.GO_VERSION }}
40-
- uses: golangci/golangci-lint-action@v6
40+
- uses: golangci/golangci-lint-action@v8
4141
with:
4242
version: ${{ env.GOLANGCI_LINT_VERSION }}
4343
args: --timeout=5m
@@ -48,7 +48,7 @@ jobs:
4848
contents: read # for actions/checkout to fetch code
4949
runs-on: ubuntu-latest
5050
steps:
51-
- uses: actions/checkout@v4
51+
- uses: actions/checkout@v5
5252
- uses: actions/setup-go@v5
5353
with:
5454
go-version: ${{ env.GO_VERSION }}

.golangci.yml

Lines changed: 107 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
1+
version: "2"
2+
13
run:
24
tests: true
35

46
issues:
57
max-same-issues: 0
68

7-
linters-settings:
8-
gci:
9-
sections:
10-
- standard
11-
- default
12-
- prefix(github.com/Antonboom/nilnil)
9+
formatters:
10+
enable:
11+
- gci
12+
- gofumpt
13+
14+
settings:
15+
gci:
16+
sections:
17+
- standard # A standard section: captures all standard packages.
18+
- default # Default section: contains all imports that could not be matched to another section type.
19+
- prefix(github.com/Antonboom/nilnil)
20+
21+
exclusions:
22+
generated: lax
1323

1424
linters:
15-
disable-all: true
25+
default: none
1626
enable:
1727
- asasalint
18-
- bidichk
1928
- asciicheck
29+
- bidichk
2030
- bodyclose
2131
- copyloopvar
2232
- dogsled
@@ -28,53 +38,133 @@ linters:
2838
- exhaustive
2939
- exptostd
3040
- forbidigo
31-
- gci
3241
- gocheckcompilerdirectives
3342
- goconst
3443
- gocritic
3544
- gocyclo
3645
- godot
3746
- godox
38-
- gofmt
39-
- gofumpt
4047
- goheader
41-
- goimports
4248
- gomoddirectives
4349
- gomodguard
4450
- goprintffuncname
4551
- gosec
46-
- gosimple
4752
- govet
4853
- importas
4954
- ineffassign
50-
- nilnil
5155
- lll
5256
- makezero
5357
- mirror
5458
- misspell
5559
- musttag
5660
- nakedret
61+
- nestif
5762
- nilerr
5863
- nilnesserr
59-
- nestif
64+
- nilnil
6065
- noctx
6166
- nolintlint
67+
- perfsprint
6268
- prealloc
6369
- predeclared
6470
- reassign
6571
- revive
6672
- sqlclosecheck
6773
- staticcheck
68-
- stylecheck
6974
- tagliatelle
7075
- testableexamples
7176
- thelper
7277
- tparallel
73-
- typecheck
7478
- unconvert
7579
- unparam
7680
- unused
7781
- usestdlibvars
7882
- usetesting
7983
- wastedassign
8084
- whitespace
85+
86+
exclusions:
87+
generated: lax
88+
presets:
89+
- comments
90+
- common-false-positives
91+
- legacy
92+
- std-error-handling
93+
94+
settings:
95+
gocritic:
96+
enable-all: true
97+
disabled-checks:
98+
- hugeParam
99+
- paramTypeCombine
100+
- stringConcatSimplify
101+
- unnecessaryBlock
102+
- whyNoLint
103+
- yodaStyleExpr
104+
105+
govet:
106+
enable-all: true
107+
disable:
108+
- fieldalignment
109+
110+
revive:
111+
severity: error
112+
rules:
113+
- name: atomic
114+
- name: blank-imports
115+
- name: bool-literal-in-expr
116+
- name: comment-spacings
117+
- name: confusing-results
118+
- name: confusing-results
119+
- name: context-as-argument
120+
arguments:
121+
- allowTypesBefore: '*testing.T'
122+
- name: context-keys-type
123+
- name: datarace
124+
- name: deep-exit
125+
- name: defer
126+
- name: dot-imports
127+
- name: duplicated-imports
128+
- name: early-return
129+
- name: empty-block
130+
- name: empty-lines
131+
- name: error-naming
132+
- name: error-return
133+
- name: error-strings
134+
- name: errorf
135+
- name: exported
136+
- name: get-return
137+
- name: identical-branches
138+
- name: if-return
139+
- name: increment-decrement
140+
- name: indent-error-flow
141+
- name: modifies-parameter
142+
- name: modifies-value-receiver
143+
- name: range
144+
- name: range-val-address
145+
- name: range-val-in-closure
146+
- name: receiver-naming
147+
- name: redundant-build-tag
148+
- name: redefines-builtin-id
149+
- name: redundant-import-alias
150+
- name: string-of-int
151+
- name: superfluous-else
152+
- name: time-equal
153+
- name: time-naming
154+
- name: unconditional-recursion
155+
- name: unexported-naming
156+
- name: unexported-return
157+
- name: unnecessary-stmt
158+
- name: unhandled-error
159+
arguments:
160+
- fmt.Fprint
161+
- fmt.Printf
162+
- fmt.Println
163+
- name: unreachable-code
164+
- name: unused-parameter
165+
- name: use-any
166+
- name: use-errors-new
167+
- name: useless-break
168+
- name: var-declaration
169+
- name: var-naming
170+
- name: waitgroup-by-value

Taskfile.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,10 @@ silent: true
66
tasks:
77
default:
88
cmds:
9-
- task: tools:install
109
- task: tidy
1110
- task: fmt
1211
- task: lint
1312
- task: test
14-
- task: install
15-
16-
tools:install:
17-
- echo "Install local tools..."
18-
- (which gci > /dev/null) || go install github.com/daixiang0/gci@latest
19-
- (which gofumpt > /dev/null) || go install mvdan.cc/gofumpt@latest
2013

2114
tidy:
2215
cmds:
@@ -26,8 +19,7 @@ tasks:
2619
fmt:
2720
cmds:
2821
- echo "Fmt..."
29-
- gofumpt -w .
30-
- gci write -s standard -s default -s "Prefix(github.com/Antonboom/nilnil)" . 2> /dev/null
22+
- golangci-lint fmt -v ./...
3123

3224
lint:
3325
cmds:

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module github.com/Antonboom/nilnil
22

3-
go 1.23.0
3+
go 1.24.0
44

5-
toolchain go1.24.1
5+
toolchain go1.25.0
66

7-
require golang.org/x/tools v0.32.0
7+
require golang.org/x/tools v0.36.0
88

99
require (
10-
golang.org/x/mod v0.24.0 // indirect
11-
golang.org/x/sync v0.13.0 // indirect
10+
golang.org/x/mod v0.28.0 // indirect
11+
golang.org/x/sync v0.17.0 // indirect
1212
)

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
22
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
3-
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
4-
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
5-
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
6-
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
7-
golang.org/x/tools v0.32.0 h1:Q7N1vhpkQv7ybVzLFtTjvQya2ewbwNDZzUgfXGqtMWU=
8-
golang.org/x/tools v0.32.0/go.mod h1:ZxrU41P/wAbZD8EDa6dDCa6XfpkhJ7HFMjHJXfBDu8s=
3+
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
4+
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
5+
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
6+
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
7+
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
8+
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=

pkg/analyzer/analyzer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var funcAndReturns = []ast.Node{
5858
(*ast.ReturnStmt)(nil),
5959
}
6060

61-
func (n *nilNil) run(pass *analysis.Pass) (interface{}, error) {
61+
func (n *nilNil) run(pass *analysis.Pass) (any, error) {
6262
insp := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
6363

6464
var fs funcTypeStack

0 commit comments

Comments
 (0)