Skip to content

Commit a36e834

Browse files
committed
Update linter
1 parent 08083f2 commit a36e834

14 files changed

+6
-32
lines changed

.github/golangci.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ run:
77
modules-download-mode: readonly
88
allow-parallel-runners: false
99
go: ""
10-
skip-dirs:
11-
- serve/filters/mocks
1210

1311
output:
1412
uniq-by-line: false
@@ -25,6 +23,8 @@ issues:
2523
linters:
2624
- nilnil
2725
- gosec
26+
exclude-dirs:
27+
- serve/filters/mocks
2828

2929
linters:
3030
fast: false
@@ -35,7 +35,7 @@ linters:
3535
- bidichk # Checks for dangerous unicode character sequences
3636
- durationcheck # Check for two durations multiplied together
3737
- errcheck # Forces to not skip error check
38-
- exportloopref # Checks for pointers to enclosing loop variables
38+
- copyloopvar # Checks for pointers to enclosing loop variables
3939
- gocritic # Bundles different linting checks
4040
- godot # Checks for periods at the end of comments
4141
- gomoddirectives # Allow or ban replace directives in go.mod
@@ -124,3 +124,6 @@ linters-settings:
124124
rules:
125125
json: goCamel
126126
yaml: goCamel
127+
gosec:
128+
excludes:
129+
- G115 # G115: integer overflow conversion uint64 -> int6

cmd/waiter.go

-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ func (w *waiter) wait() error {
5353
})
5454

5555
for _, fn := range w.waitFns {
56-
fn := fn
57-
5856
g.Go(
5957
func() error {
6058
return fn(ctx)

events/subscription_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ func TestSubscription_EventSupported(t *testing.T) {
3939
}
4040

4141
for _, testCase := range testTable {
42-
testCase := testCase
43-
4442
t.Run(testCase.name, func(t *testing.T) {
4543
t.Parallel()
4644

fetch/slots_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ func TestSlots_FindGaps(t *testing.T) {
146146
}
147147

148148
for _, testCase := range testTable {
149-
testCase := testCase
150-
151149
t.Run(testCase.name, func(t *testing.T) {
152150
t.Parallel()
153151

go.mod

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module github.com/gnolang/tx-indexer
22

33
go 1.22
44

5-
toolchain go1.22.5
6-
75
require (
86
github.com/99designs/gqlgen v0.17.49
97
github.com/cockroachdb/pebble v1.1.2

serve/filters/filter/base_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ func TestBaseFilter_GetType(t *testing.T) {
2020
}
2121

2222
for _, testCase := range testTable {
23-
testCase := testCase
24-
2523
t.Run(testCase.name, func(t *testing.T) {
2624
t.Parallel()
2725

serve/filters/filter/block_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ func TestBlockFilter_GetChanges(t *testing.T) {
3838

3939
// Update the block filter with dummy blocks
4040
for _, block := range blocks {
41-
block := block
42-
4341
f.UpdateWith(block)
4442
}
4543

serve/filters/filter/tx_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ func TestApplyFilters(t *testing.T) {
221221
}
222222

223223
for _, tt := range tests {
224-
tt := tt
225224
t.Run(tt.name, func(t *testing.T) {
226225
t.Parallel()
227226

@@ -295,7 +294,6 @@ func TestApplyFiltersWithLargeData(t *testing.T) {
295294
}
296295

297296
for _, tt := range tests {
298-
tt := tt
299297
t.Run(tt.name, func(t *testing.T) {
300298
t.Parallel()
301299

serve/filters/manager_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ func Test_NewBlockEvents(t *testing.T) {
9999
defer filterManager.UninstallFilter(id)
100100

101101
for _, block := range blocks {
102-
block := block
103-
104102
blockCh <- &types.NewBlock{
105103
Block: block,
106104
}

serve/filters/subscription.go

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ func (sm *subscriptionMap) sendEvent(eventType events.Type, data any) {
6161
}
6262

6363
for id, sub := range sm.subscriptions {
64-
sub := sub
6564
if sub.GetType() != eventType {
6665
continue
6766
}

serve/handler_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ func TestHTTP_Handle(t *testing.T) {
9999
}
100100

101101
for _, testCase := range testTable {
102-
testCase := testCase
103-
104102
t.Run(testCase.name, func(t *testing.T) {
105103
t.Parallel()
106104

serve/handlers/block/block_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ func TestGetBlock_InvalidParams(t *testing.T) {
3333
}
3434

3535
for _, testCase := range testTable {
36-
testCase := testCase
37-
3836
t.Run(testCase.name, func(t *testing.T) {
3937
t.Parallel()
4038

serve/handlers/subs/subs_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ func TestUninstallFilter_InvalidParams(t *testing.T) {
108108
}
109109

110110
for _, testCase := range testTable {
111-
testCase := testCase
112-
113111
t.Run(testCase.name, func(t *testing.T) {
114112
t.Parallel()
115113

@@ -211,8 +209,6 @@ func TestGetFilterChanges_InvalidParams(t *testing.T) {
211209
}
212210

213211
for _, testCase := range testTable {
214-
testCase := testCase
215-
216212
t.Run(testCase.name, func(t *testing.T) {
217213
t.Parallel()
218214

@@ -546,8 +542,6 @@ func TestSubscribeUnsubscribe_InvalidParams(t *testing.T) {
546542
}
547543

548544
for _, testCase := range testTable {
549-
testCase := testCase
550-
551545
t.Run(testCase.name, func(t *testing.T) {
552546
t.Parallel()
553547

serve/handlers/tx/tx_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ func TestGetTx_InvalidParams(t *testing.T) {
3232
}
3333

3434
for _, testCase := range testTable {
35-
testCase := testCase
36-
3735
t.Run(testCase.name, func(t *testing.T) {
3836
t.Parallel()
3937

0 commit comments

Comments
 (0)