Skip to content

Commit 6f46bae

Browse files
mpywclaude
andcommitted
fix: Remove sync.WaitGroup.Go from spawnerlabel tests for Go 1.24 compatibility
sync.WaitGroup.Go() was added in Go 1.25, so remove it from spawnerlabel tests to maintain compatibility with Go 1.24. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 914bd6a commit 6f46bae

File tree

2 files changed

+2
-28
lines changed

2 files changed

+2
-28
lines changed

testdata/src/spawnerlabel/basic.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package spawnerlabel
44
import (
55
"context"
66
"fmt"
7-
"sync"
87

98
"golang.org/x/sync/errgroup"
109

@@ -33,15 +32,6 @@ func missingLabelErrgroupTryGo() { // want `function "missingLabelErrgroupTryGo"
3332
_ = g.Wait()
3433
}
3534

36-
// [BAD]: Missing label - calls sync.WaitGroup.Go with func arg
37-
func missingLabelWaitgroup() { // want `function "missingLabelWaitgroup" should have //goroutinectx:spawner directive \(calls sync\.WaitGroup\.Go with func argument\)`
38-
var wg sync.WaitGroup
39-
wg.Go(func() {
40-
fmt.Println("work")
41-
})
42-
wg.Wait()
43-
}
44-
4535
// [BAD]: Missing label - calls gotask.DoAllFnsSettled with func arg
4636
func missingLabelGotaskDoAll(ctx context.Context) { // want `function "missingLabelGotaskDoAll" should have //goroutinectx:spawner directive \(calls gotask\.DoAllFnsSettled with func argument\)`
4737
gotask.DoAllFnsSettled(ctx,

testdata/src/spawnerlabel/evil.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package spawnerlabel
44
import (
55
"context"
66
"fmt"
7-
"sync"
87

98
"golang.org/x/sync/errgroup"
109

@@ -126,19 +125,6 @@ func evilGotaskDoAllFns(ctx context.Context) { // want `function "evilGotaskDoAl
126125
)
127126
}
128127

129-
// ===== WAITGROUP PATTERNS =====
130-
131-
// [GOOD]: Traditional WaitGroup pattern (Add/Done) - not spawn method
132-
func goodTraditionalWaitgroup() {
133-
var wg sync.WaitGroup
134-
wg.Add(1)
135-
go func() {
136-
defer wg.Done()
137-
fmt.Println("work")
138-
}()
139-
wg.Wait()
140-
}
141-
142128
// ===== LIMITATIONS =====
143129

144130
// LIMITATION: Spawn in nested function literal - only direct children checked
@@ -268,12 +254,10 @@ func multipleSpawnTypes() { // want `function "multipleSpawnTypes" should have /
268254
g.Go(func() error {
269255
return nil
270256
})
271-
var wg sync.WaitGroup
272-
wg.Go(func() {
273-
fmt.Println("work")
257+
g.TryGo(func() error {
258+
return nil
274259
})
275260
_ = g.Wait()
276-
wg.Wait()
277261
}
278262

279263
// [GOOD]: Struct with func field - field doesn't count as func param

0 commit comments

Comments
 (0)