Skip to content

Commit c055b2b

Browse files
authored
Go 1.24 (#234)
1 parent eddb08e commit c055b2b

File tree

10 files changed

+39
-34
lines changed

10 files changed

+39
-34
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
branches: [ master ]
99

1010
env:
11-
GO_VERSION: ^1.23
12-
GOLANGCI_LINT_VERSION: v1.61.0
11+
GO_VERSION: ^1.24
12+
GOLANGCI_LINT_VERSION: v1.64.7
1313

1414
permissions:
1515
contents: read

.golangci.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,13 @@ linters:
103103
- asasalint
104104
- asciicheck
105105
- bidichk
106+
- copyloopvar
106107
- depguard
108+
- durationcheck
107109
- errcheck
108110
- errname
109111
- exhaustive
112+
- exptostd
110113
- forbidigo
111114
- gci
112115
- gocheckcompilerdirectives
@@ -120,27 +123,30 @@ linters:
120123
- gosimple
121124
- govet
122125
- ineffassign
126+
- intrange
123127
- lll
124128
- makezero
125129
- mirror
126130
- misspell
127131
- nakedret
128132
- nilerr
133+
- nilnesserr
129134
- nestif
130135
- nolintlint
136+
- perfsprint
131137
- prealloc
132138
- predeclared
133139
- reassign
134140
- revive
135141
- staticcheck
136142
- stylecheck
137-
- tenv
138143
- testableexamples
139144
- testpackage
140145
- thelper
141146
- unconvert
142147
- unparam
143148
- unused
144149
- usestdlibvars
150+
- usetesting
145151
- wastedassign
146152
- whitespace

analyzer/analyzer_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ func TestTestifyLint(t *testing.T) {
1414
t.Parallel()
1515

1616
for _, checker := range checkers.All() {
17-
checker := checker
18-
1917
t.Run(checker, func(t *testing.T) {
2018
t.Parallel()
2119

@@ -176,8 +174,6 @@ func TestTestifyLint_NotDefaultCases(t *testing.T) {
176174
}
177175

178176
for _, tt := range cases {
179-
tt := tt
180-
181177
t.Run(tt.dir, func(t *testing.T) {
182178
t.Parallel()
183179

analyzer/testdata/src/debug/suite_method_signature_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ func (s *BrokenSuite) TestTypo(_ *testing.T) { // value.go:424: test panicked: r
2727

2828
/*
2929
1) Flagged by govet (copylocks).
30-
2) Related to https://github.com/go-critic/go-critic/issues/331.
30+
2) Flagged by https://golangci-lint.run/usage/linters/#recvcheck.
31+
3) Related to https://github.com/go-critic/go-critic/issues/331.
3132
*/
3233
func (s BrokenSuite) TestValueReceiver() {
3334
s.True(true)

go.mod

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
module github.com/Antonboom/testifylint
22

3-
go 1.22.1
3+
go 1.23.0
44

5-
require golang.org/x/tools v0.29.0
5+
toolchain go1.24.1
6+
7+
require golang.org/x/tools v0.31.0
68

79
require (
8-
golang.org/x/mod v0.22.0 // indirect
9-
golang.org/x/sync v0.10.0 // indirect
10+
golang.org/x/mod v0.24.0 // indirect
11+
golang.org/x/sync v0.12.0 // indirect
1012
)

go.sum

+6-6
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.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
4-
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
5-
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
6-
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
7-
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
8-
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
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.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
6+
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
7+
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
8+
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=

internal/checkers/formatter.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func assertHasFormattedAnalogue(pass *analysis.Pass, call *CallMeta) bool {
230230
if !ok {
231231
return false
232232
}
233-
for i := 0; i < suite.NumMethods(); i++ {
233+
for i := range suite.NumMethods() {
234234
if suite.Method(i).Name() == call.Fn.Name+"f" {
235235
return true
236236
}
@@ -256,7 +256,7 @@ func getMsgAndArgsPosition(sig *types.Signature) int {
256256
}
257257

258258
func getMsgPosition(sig *types.Signature) int {
259-
for i := 0; i < sig.Params().Len(); i++ {
259+
for i := range sig.Params().Len() {
260260
param := sig.Params().At(i)
261261

262262
if b, ok := param.Type().(*types.Basic); ok && b.Kind() == types.String && (param.Name() == "msg" ||

internal/checkers/helpers_http.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func mimicHTTPHandler(pass *analysis.Pass, fType *ast.FuncType) bool {
2424
return false
2525
}
2626

27-
for i := 0; i < sig.Params().Len(); i++ {
27+
for i := range sig.Params().Len() {
2828
lhs := sig.Params().At(i).Type()
2929
rhs := pass.TypesInfo.TypeOf(fType.Params.List[i].Type)
3030
if !types.Identical(lhs, rhs) {

internal/checkers/suite_thelper.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (checker SuiteTHelper) Check(pass *analysis.Pass, inspector *inspector.Insp
4343
}
4444
rcvName := rcv.Names[0].Name
4545

46-
helperCallStr := fmt.Sprintf("%s.T().Helper()", rcvName)
46+
helperCallStr := rcvName + ".T().Helper()"
4747

4848
firstStmt := fd.Body.List[0]
4949
if analysisutil.NodeString(pass.Fset, firstStmt) == helperCallStr {

internal/testgen/gen_negative_positive.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func (g NegativePositiveTestsGenerator) TemplateData() any {
2525
for _, zeroType := range []string{
2626
"", "int", "int8", "int16", "int32", "int64",
2727
} {
28-
v := fmt.Sprintf("%s(a)", zeroType)
29-
zero := fmt.Sprintf("%s(0)", zeroType)
28+
v := zeroType + "(a)"
29+
zero := zeroType + "(0)"
3030

3131
if zeroType == "" {
3232
v, zero = "a", "0"
@@ -46,8 +46,8 @@ func (g NegativePositiveTestsGenerator) TemplateData() any {
4646
"", "int", "int8", "int16", "int32", "int64",
4747
"uint", "uint8", "uint16", "uint32", "uint64",
4848
} {
49-
v := fmt.Sprintf("%s(a)", zeroType)
50-
zero := fmt.Sprintf("%s(0)", zeroType)
49+
v := zeroType + "(a)"
50+
zero := zeroType + "(0)"
5151

5252
if zeroType == "" {
5353
v, zero = "a", "0"
@@ -85,8 +85,8 @@ func (g NegativePositiveTestsGenerator) TemplateData() any {
8585
"uint", "uint8", "uint16", "uint32", "uint64",
8686
"CustomInt16",
8787
} {
88-
v := fmt.Sprintf("%s(a)", zeroType)
89-
zero := fmt.Sprintf("%s(0)", zeroType)
88+
v := zeroType + "(a)"
89+
zero := zeroType + "(0)"
9090

9191
ignoredAssertions = append(ignoredAssertions,
9292
Assertion{Fn: fn, Argsf: zero + ", " + v},
@@ -120,8 +120,8 @@ func (g NegativePositiveTestsGenerator) TemplateData() any {
120120
"uint", "uint8", "uint16", "uint32", "uint64",
121121
"CustomInt16",
122122
} {
123-
v := fmt.Sprintf("%s(a)", zeroType)
124-
zero := fmt.Sprintf("%s(0)", zeroType)
123+
v := zeroType + "(a)"
124+
zero := zeroType + "(0)"
125125

126126
if zeroType == "" {
127127
v, zero = "a", "0"
@@ -140,8 +140,8 @@ func (g NegativePositiveTestsGenerator) TemplateData() any {
140140
"uint", "uint8", "uint16", "uint32", "uint64",
141141
"CustomInt16",
142142
} {
143-
v := fmt.Sprintf("%s(a)", zeroType)
144-
zero := fmt.Sprintf("%s(0)", zeroType)
143+
v := zeroType + "(a)"
144+
zero := zeroType + "(0)"
145145

146146
if zeroType == "" {
147147
v, zero = "a", "0"
@@ -160,8 +160,8 @@ func (g NegativePositiveTestsGenerator) TemplateData() any {
160160
"uint", "uint8", "uint16", "uint32", "uint64",
161161
"CustomInt16",
162162
} {
163-
v := fmt.Sprintf("%s(a)", zeroType)
164-
zero := fmt.Sprintf("%s(0)", zeroType)
163+
v := zeroType + "(a)"
164+
zero := zeroType + "(0)"
165165

166166
ignoredAssertions = append(ignoredAssertions,
167167
Assertion{Fn: "Less", Argsf: v + ", " + zero},

0 commit comments

Comments
 (0)