Use go 1.25 waitgroup Go method instead of Add/Wait (#3265)

* Use go 1.25 waitgroup Go method instead of Add/Wait

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Disable java builder test for now

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2025-10-30 14:32:44 +05:30
committed by GitHub
parent 4ebdb077b5
commit ebdce4c0ed
11 changed files with 96 additions and 113 deletions
+2 -4
View File
@@ -36,11 +36,9 @@ func New() Interface {
}
}
func (g *GroupManager) Add(ctx context.Context, f func(context.Context)) {
g.wg.Add(1)
go func() {
defer g.wg.Done()
g.wg.Go(func() {
f(ctx)
}()
})
}
func (g *GroupManager) AddInformers(ctx context.Context, informers map[string]k8sCache.SharedIndexInformer) {
+2 -4
View File
@@ -23,9 +23,7 @@ func chunkedHandler(w http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithCancel(r.Context())
ticker := time.NewTicker(time.Second) // We may set it to 10 secs
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
for {
select {
case <-ticker.C:
@@ -37,7 +35,7 @@ func chunkedHandler(w http.ResponseWriter, r *http.Request) {
return
}
}
}()
})
// Emulate some work
time.Sleep(5 * time.Second)