Skip to content

Commit ea2559f

Browse files
authored
Merge pull request #203 from alexandear-org/chore/enable-modernize-linter
♻️ refactor: remove redundant modernize workflow
2 parents 02a1e60 + ad3d4a7 commit ea2559f

15 files changed

Lines changed: 30 additions & 68 deletions

.github/workflows/benchmark.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ jobs:
2828
- name: Install Go
2929
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
3030
with:
31-
# NOTE: Keep this in sync with the version from go.mod
32-
go-version: "1.25.x"
31+
go-version-file: go.mod
3332

3433
- name: Run Benchmark
3534
run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ permissions:
2222
jobs:
2323
lint:
2424
uses: gofiber/.github/.github/workflows/go-lint-single.yml@main
25+
with:
26+
golangci-lint-version: v2.12.2

.github/workflows/modernize.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
Build:
2323
strategy:
2424
matrix:
25-
go-version: [1.24.x, 1.25.x]
25+
go-version: [1.25.x, 1.26.x]
2626
platform: [ubuntu-latest, windows-latest, macos-latest]
2727
runs-on: ${{ matrix.platform }}
2828
steps:
@@ -44,7 +44,7 @@ jobs:
4444
run: gotestsum -f testname -- ./... -race -count=1 -coverprofile=coverage.txt -covermode=atomic -shuffle=on
4545

4646
- name: Upload coverage reports to Codecov
47-
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.go-version == '1.25.x' }}
47+
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.go-version == '1.26.x' }}
4848
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6
4949
with:
5050
token: ${{ secrets.CODECOV_TOKEN }}

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ linters:
194194
disabled: true # TODO: Do not disable
195195
- name: package-comments
196196
disabled: true
197+
- name: package-naming
198+
disabled: true
197199
- name: optimize-operands-order
198200
disabled: true
199201
- name: unchecked-type-assertion
@@ -320,6 +322,7 @@ linters:
320322
# - maligned
321323
- mirror
322324
- misspell
325+
- modernize
323326
- musttag
324327
- nakedret
325328
# - nestif

byteseq_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ func Test_TrimSpace(t *testing.T) {
351351
}
352352

353353
for _, tc := range testCases {
354-
tc := tc
355354
t.Run(tc.name, func(t *testing.T) {
356355
t.Parallel()
357356
// Test string variant - must match strings.TrimSpace
@@ -370,7 +369,6 @@ func Test_TrimSpace(t *testing.T) {
370369

371370
func Benchmark_TrimSpace(b *testing.B) {
372371
for _, tc := range trimSpaceBenchmarkCases {
373-
tc := tc // capture range variable
374372
b.Run("fiber/"+tc.name, func(b *testing.B) {
375373
b.ReportAllocs()
376374
b.SetBytes(int64(len(tc.input)))
@@ -396,7 +394,6 @@ func Benchmark_TrimSpace(b *testing.B) {
396394

397395
func Benchmark_TrimSpaceBytes(b *testing.B) {
398396
for _, tc := range trimSpaceBenchmarkCases {
399-
tc := tc // capture range variable
400397
input := []byte(tc.input)
401398
b.Run("fiber/"+tc.name, func(b *testing.B) {
402399
b.ReportAllocs()

common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func GetArgument(arg string) bool {
118118

119119
// IncrementIPRange Find available next IP address
120120
func IncrementIPRange(ip net.IP) {
121-
for j := len(ip) - 1; j >= 0; j-- {
121+
for j := len(ip) - 1; j >= 0; j-- { //nolint:modernize // slicesbackward: false positive
122122
ip[j]++
123123
if ip[j] > 0 {
124124
break

common_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ func Test_UUIDv4_Concurrency(t *testing.T) {
6060
var res string
6161
ch := make(chan string, iterations)
6262
results := make(map[string]string)
63-
for i := 0; i < iterations; i++ {
63+
for range iterations {
6464
go func() {
6565
ch <- UUIDv4()
6666
}()
6767
}
68-
for i := 0; i < iterations; i++ {
68+
for range iterations {
6969
res = <-ch
7070
results[res] = res
7171
}
@@ -103,12 +103,12 @@ func Test_GenerateSecureToken_Concurrency(t *testing.T) {
103103
iterations := 1000
104104
ch := make(chan string, iterations)
105105
results := make(map[string]string)
106-
for i := 0; i < iterations; i++ {
106+
for range iterations {
107107
go func() {
108108
ch <- GenerateSecureToken(32)
109109
}()
110110
}
111-
for i := 0; i < iterations; i++ {
111+
for range iterations {
112112
res := <-ch
113113
results[res] = res
114114
}
@@ -260,7 +260,6 @@ func Test_IncrementIPRange(t *testing.T) {
260260
}
261261

262262
for _, c := range cases {
263-
c := c
264263
t.Run(c.input.String(), func(t *testing.T) {
265264
t.Parallel()
266265
IncrementIPRange(c.input)
@@ -282,7 +281,6 @@ func Test_IncrementIPRange_IPv6(t *testing.T) {
282281
}
283282

284283
for _, c := range cases {
285-
c := c
286284
t.Run(c.input.String(), func(t *testing.T) {
287285
t.Parallel()
288286
IncrementIPRange(c.input)

convert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ func ToString(arg any, timeFormat ...string) string {
221221
return ""
222222
}
223223
kind := rv.Kind()
224-
if kind == reflect.Ptr && !rv.IsNil() {
224+
if kind == reflect.Pointer && !rv.IsNil() {
225225
// Dereference the pointer and recursively call ToString
226226
return ToString(rv.Elem().Interface(), timeFormat...)
227227
} else if kind == reflect.Slice || kind == reflect.Array {

convert_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ func Test_ToString(t *testing.T) {
130130
}
131131

132132
for _, tc := range tests {
133-
tc := tc // capture range variable
134133
t.Run(tc.name, func(t *testing.T) {
135134
t.Parallel()
136135
var res string
@@ -152,7 +151,6 @@ func Test_ToString(t *testing.T) {
152151
{&intPtr, "42"},
153152
}
154153
for _, tc := range testsPtr {
155-
tc := tc
156154
t.Run("pointer to "+reflect.TypeOf(tc.input).Elem().String(), func(t *testing.T) {
157155
t.Parallel()
158156
res := ToString(tc.input)

0 commit comments

Comments
 (0)