Skip to content

Commit 10985cc

Browse files
committed
authz/loader: fix unused param lint, go mod tidy
1 parent bd02886 commit 10985cc

4 files changed

Lines changed: 23 additions & 22 deletions

File tree

authz/loader/atomic_rename_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
// Copyright 2026 Redpanda Data, Inc.
2+
//
3+
// Use of this software is governed by the Business Source License
4+
// included in the file licenses/BSL.md
5+
//
6+
// As of the Change Date specified in that file, in accordance with
7+
// the Business Source License, use of this software will be governed
8+
// by the Apache License, Version 2.0
9+
110
package loader_test
211

312
import (
@@ -7,10 +16,11 @@ import (
716
"testing"
817
"time"
918

10-
"github.com/redpanda-data/common-go/authz"
11-
"github.com/redpanda-data/common-go/authz/loader"
1219
"github.com/stretchr/testify/assert"
1320
"github.com/stretchr/testify/require"
21+
22+
"github.com/redpanda-data/common-go/authz"
23+
"github.com/redpanda-data/common-go/authz/loader"
1424
)
1525

1626
// TestWatchPolicyFile_AtomicRename reproduces the neovim atomic save pattern

authz/loader/loader_watch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func TestWatchUnwatch(t *testing.T) {
8080
writeTestPolicy(t, path, 1)
8181

8282
var calls atomic.Int32
83-
policy, unwatch, err := loader.WatchPolicyFile(path, func(p authz.Policy, err error) {
83+
policy, unwatch, err := loader.WatchPolicyFile(path, func(_ authz.Policy, _ error) {
8484
calls.Add(1)
8585
})
8686
require.NoError(t, err)

kvstore/client_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,9 @@ func TestSync_NoSpuriousWakeups(t *testing.T) {
185185
// Send broadcasts at intermediate offsets
186186
var wg sync.WaitGroup
187187
for i := 1; i < 100; i++ {
188-
wg.Add(1)
189-
go func(offset int) {
190-
defer wg.Done()
191-
c.setOffset(int64(offset))
192-
}(i)
188+
wg.Go(func() {
189+
c.setOffset(int64(i))
190+
})
193191
}
194192
wg.Wait()
195193

kvstore/sync_test.go

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,13 @@ func TestSync_ConcurrentPuts(t *testing.T) {
9797
errCount := make(chan struct{}, numWrites)
9898

9999
for i := 0; i < numWrites; i++ {
100-
wg.Add(1)
101-
go func(i int) {
102-
defer wg.Done()
100+
wg.Go(func() {
103101
key := []byte(fmt.Sprintf("key-%d", i))
104102
value := fmt.Sprintf("value-%d", i)
105103
if err := client.Put(ctx, key, []byte(value)); err != nil {
106104
errCount <- struct{}{}
107105
}
108-
}(i)
106+
})
109107
}
110108

111109
wg.Wait()
@@ -437,17 +435,15 @@ func TestMultiClient_ConcurrentWrites(t *testing.T) {
437435
// Each client writes its own set of keys concurrently
438436
var wg sync.WaitGroup
439437
for clientID := 0; clientID < numClients; clientID++ {
440-
wg.Add(1)
441-
go func(clientID int) {
442-
defer wg.Done()
438+
wg.Go(func() {
443439
client := clients[clientID]
444440
for i := 0; i < writesPerClient; i++ {
445441
key := []byte(fmt.Sprintf("client%d-key%d", clientID, i))
446442
value := []byte(fmt.Sprintf("client%d-value%d", clientID, i))
447443
err := client.Put(ctx, key, value)
448444
require.NoError(t, err)
449445
}
450-
}(clientID)
446+
})
451447
}
452448

453449
wg.Wait()
@@ -579,11 +575,8 @@ func TestSync_StressReadYourOwnWrites(t *testing.T) {
579575
var totalOps atomic.Int64
580576
var wg sync.WaitGroup
581577

582-
for p := 0; p < numProducers; p++ {
583-
wg.Add(1)
584-
go func(producerID int) {
585-
defer wg.Done()
586-
578+
for producerID := 0; producerID < numProducers; producerID++ {
579+
wg.Go(func() {
587580
// Each producer has its own key - no concurrent writes to same key
588581
key := []byte(fmt.Sprintf("producer-%d-key", producerID))
589582

@@ -618,7 +611,7 @@ func TestSync_StressReadYourOwnWrites(t *testing.T) {
618611

619612
totalOps.Add(1)
620613
}
621-
}(p)
614+
})
622615
}
623616

624617
wg.Wait()

0 commit comments

Comments
 (0)