Skip to content

Commit f0a5970

Browse files
Copilotfredbi
andcommitted
fix(leak): address linting issues - nolint:gochecknoglobals and wg.Go
- Add //nolint:gochecknoglobals annotation with justification on compatOnce - Replace wg.Add(1)/go func()/defer wg.Done() with wg.Go() (Go 1.25) Signed-off-by: GitHub Copilot <[email protected]> Co-authored-by: fredbi <[email protected]>
1 parent 2d5d8b1 commit f0a5970

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

internal/leak/leak.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const (
2525
waitFactor = 2
2626
)
2727

28-
var compatOnce sync.Once
28+
var compatOnce sync.Once //nolint:gochecknoglobals // lazy guard for undocumented pprof label format
2929

3030
// ensureCompatible checks that the pprof goroutine profile labels
3131
// are formatted as expected. It runs at most once and panics if the
@@ -43,11 +43,9 @@ func ensureCompatible() {
4343
id := uniqueLabel()
4444
labels := pprof.Labels(labelKey, id)
4545
pprof.Do(context.Background(), labels, func(_ context.Context) {
46-
wg.Add(1)
47-
go func() {
48-
defer wg.Done()
46+
wg.Go(func() {
4947
<-blocker // leaked: blocks forever until cleanup
50-
}()
48+
})
5149
})
5250
needle := buildNeedle(id)
5351
profile := captureProfile()

0 commit comments

Comments
 (0)