Skip to content

Commit 82b2d97

Browse files
fix lint
1 parent 94d537c commit 82b2d97

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

modules/globallock/locker_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,13 @@ func testLocker(t *testing.T, locker Locker) {
105105
require.NoError(t, err)
106106

107107
wg := &sync.WaitGroup{}
108-
wg.Add(1)
109-
go func() {
110-
defer wg.Done()
108+
wg.Go(func() {
111109
started := time.Now()
112110
release, err := locker.Lock(t.Context(), "test") // should be blocked for seconds
113111
defer release()
114112
assert.Greater(t, time.Since(started), time.Second)
115113
assert.NoError(t, err)
116-
}()
114+
})
117115

118116
time.Sleep(2 * time.Second)
119117
release()

modules/json/jsonv2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package json
77

88
import (
9-
jsonv2 "encoding/json/v2"
9+
jsonv2 "encoding/json/v2" //nolint:depguard // this package wraps it
1010
"io"
1111
)
1212

modules/log/event_writer_conn_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ func TestConnLogger(t *testing.T) {
6262
}
6363
expected := fmt.Sprintf("%s%s %s:%d:%s [%c] %s\n", prefix, dateString, event.Filename, event.Line, event.Caller, strings.ToUpper(event.Level.String())[0], event.MsgSimpleText)
6464
var wg sync.WaitGroup
65-
wg.Add(1)
66-
go func() {
67-
defer wg.Done()
65+
wg.Go(func() {
6866
listenReadAndClose(t, l, expected)
69-
}()
67+
})
7068
logger.SendLogEvent(&event)
7169
wg.Wait()
7270

modules/queue/workergroup.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,8 @@ func resetIdleTicker(t *time.Ticker, dur time.Duration) {
153153

154154
// doStartNewWorker starts a new worker for the queue, the worker reads from worker's channel and handles the items.
155155
func (q *WorkerPoolQueue[T]) doStartNewWorker(wp *workerGroup[T]) {
156-
wp.wg.Add(1)
157156

158-
go func() {
159-
defer wp.wg.Done()
157+
&{wp wg}.Go(func() {
160158

161159
log.Debug("Queue %q starts new worker", q.GetName())
162160
defer log.Debug("Queue %q stops idle worker", q.GetName())
@@ -192,7 +190,7 @@ func (q *WorkerPoolQueue[T]) doStartNewWorker(wp *workerGroup[T]) {
192190
q.workerNumMu.Unlock()
193191
}
194192
}
195-
}()
193+
})
196194
}
197195

198196
// doFlush flushes the queue: it tries to read all items from the queue and handles them.

0 commit comments

Comments
 (0)