Skip to content

Commit f668537

Browse files
authored
chore: Bump golangci-lint to v1.60.3 (#3119)
Bump golangci-lint to v1.60.3
1 parent 4acdc60 commit f668537

File tree

20 files changed

+31
-42
lines changed

20 files changed

+31
-42
lines changed

.github/workflows/linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
uses: golangci/golangci-lint-action@v6
3838
with:
3939
# NOTE: Keep this in sync with the version from .golangci.yml
40-
version: v1.60.1
40+
version: v1.60.3

.github/workflows/markdown.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ on:
55
branches:
66
- master
77
- main
8-
paths:
9-
- "**/*.md"
108
pull_request:
11-
paths:
12-
- "**/*.md"
139

1410
jobs:
1511
markdownlint:

.golangci.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ linters:
278278
- depguard
279279
- dogsled
280280
# - dupl
281-
# - dupword # TODO: Enable
281+
- dupword # TODO: Enable
282282
- durationcheck
283283
- errcheck
284284
- errchkjson
@@ -287,7 +287,7 @@ linters:
287287
- exhaustive
288288
# - exhaustivestruct
289289
# - exhaustruct
290-
- exportloopref
290+
- copyloopvar
291291
- forbidigo
292292
- forcetypeassert
293293
# - funlen
@@ -298,7 +298,7 @@ linters:
298298
# - gochecknoinits # TODO: Enable
299299
- gochecksumtype
300300
# - gocognit
301-
# - goconst # TODO: Enable
301+
- goconst # TODO: Enable
302302
- gocritic
303303
# - gocyclo
304304
# - godot
@@ -307,9 +307,8 @@ linters:
307307
- gofmt
308308
- gofumpt
309309
# - goheader
310-
# - goimports
311-
# - golint
312-
# - gomnd # TODO: Enable
310+
- goimports
311+
# - mnd # TODO: Enable
313312
- gomoddirectives
314313
# - gomodguard
315314
- goprintffuncname

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ markdown:
3535
## lint: 🚨 Run lint checks
3636
.PHONY: lint
3737
lint:
38-
go run github.com/golangci/golangci-lint/cmd/[email protected].1 run ./...
38+
go run github.com/golangci/golangci-lint/cmd/[email protected].3 run ./...
3939

4040
## test: 🚦 Execute all tests
4141
.PHONY: test

addon/retry/exponential_backoff_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ func Test_ExponentialBackoff_Retry(t *testing.T) {
5151
}
5252

5353
for _, tt := range tests {
54-
tt := tt
5554
t.Run(tt.name, func(t *testing.T) {
5655
t.Parallel()
5756
err := tt.expBackoff.Retry(tt.f)
@@ -106,7 +105,6 @@ func Test_ExponentialBackoff_Next(t *testing.T) {
106105
}
107106

108107
for _, tt := range tests {
109-
tt := tt
110108
t.Run(tt.name, func(t *testing.T) {
111109
t.Parallel()
112110
for i := 0; i < tt.expBackoff.MaxRetryCount; i++ {

client/core_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func Test_AddMissing_Port(t *testing.T) {
4949
},
5050
}
5151
for _, tt := range tests {
52-
tt := tt // create a new 'tt' variable for the goroutine
5352
t.Run(tt.name, func(t *testing.T) {
5453
t.Parallel()
5554
require.Equal(t, tt.want, addMissingPort(tt.args.addr, tt.args.isTLS))

client/hooks_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func Test_Rand_String(t *testing.T) {
3535
},
3636
}
3737
for _, tt := range tests {
38-
tt := tt
3938
t.Run(tt.name, func(t *testing.T) {
4039
t.Parallel()
4140
got := randString(tt.args)
@@ -188,7 +187,7 @@ func Test_Parser_Request_URL(t *testing.T) {
188187
flag1 = true
189188
case "foo2":
190189
flag2 = true
191-
case "foo":
190+
case "foo": //nolint:goconst // test
192191
flag3 = true
193192
}
194193
}

client/request_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,7 @@ func Test_SetValWithStruct(t *testing.T) {
13401340

13411341
require.True(t, func() bool {
13421342
for _, v := range p.PeekMulti("TSlice") {
1343-
if string(v) == "bar" {
1343+
if string(v) == "bar" { //nolint:goconst // test
13441344
return true
13451345
}
13461346
}

ctx_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,6 @@ func Test_Ctx_UserContext_Multiple_Requests(t *testing.T) {
908908

909909
// Consecutive Requests
910910
for i := 1; i <= 10; i++ {
911-
i := i
912911
t.Run(fmt.Sprintf("request_%d", i), func(t *testing.T) {
913912
t.Parallel()
914913
resp, err := app.Test(httptest.NewRequest(MethodGet, fmt.Sprintf("/?input=%d", i), nil))
@@ -3122,8 +3121,6 @@ func Test_Static_Compress(t *testing.T) {
31223121
// Note: deflate is not supported by fasthttp.FS
31233122
algorithms := []string{"zstd", "gzip", "br"}
31243123
for _, algo := range algorithms {
3125-
algo := algo
3126-
31273124
t.Run(algo+"_compression", func(t *testing.T) {
31283125
t.Parallel()
31293126

@@ -3338,7 +3335,6 @@ func Test_Ctx_SendFile_Immutable(t *testing.T) {
33383335
}
33393336

33403337
for _, endpoint := range endpointsForTest {
3341-
endpoint := endpoint
33423338
t.Run(endpoint, func(t *testing.T) {
33433339
t.Parallel()
33443340
// 1st try

helpers.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func getSplicedStrList(headerValue string, dst []string) []string {
326326
var (
327327
index int
328328
character rune
329-
lastElementEndsAt uint8
329+
lastElementEndsAt int
330330
insertIndex int
331331
)
332332
for index, character = range headerValue + "$" {
@@ -337,7 +337,7 @@ func getSplicedStrList(headerValue string, dst []string) []string {
337337
copy(dst, oldSlice)
338338
}
339339
dst[insertIndex] = utils.TrimLeft(headerValue[lastElementEndsAt:index], ' ')
340-
lastElementEndsAt = uint8(index + 1)
340+
lastElementEndsAt = index + 1
341341
insertIndex++
342342
}
343343
}
@@ -766,6 +766,7 @@ func genericParseBool[V GenericType](str string, parser func(bool) V, defaultVal
766766
return genericParseDefault[V](err, func() V { return parser(result) }, defaultValue...)
767767
}
768768

769+
//nolint:gosec // Casting in this function is not a concern
769770
func genericParseType[V GenericType](str string, v V, defaultValue ...V) V {
770771
switch any(v).(type) {
771772
case int:

0 commit comments

Comments
 (0)