Use modern WaitGroup.Go function in additional places

This commit is contained in:
Jesper Noordsij
2026-03-06 15:22:06 +01:00
committed by GitHub
parent 9ab7fb860d
commit c7d5507462
4 changed files with 5 additions and 12 deletions
-1
View File
@@ -515,7 +515,6 @@ func TestDifferentIntervals(t *testing.T) {
wg := sync.WaitGroup{}
wg.Go(func() {
hc.Launch(ctx)
wg.Done()
})
select {
+2 -4
View File
@@ -192,11 +192,9 @@ func TestBasicAuthConcurrentHashOnce(t *testing.T) {
defer ts.Close()
var wg sync.WaitGroup
wg.Add(2)
for range 2 {
go func() {
defer wg.Done()
wg.Go(func() {
req := testhelpers.MustNewRequest(http.MethodGet, ts.URL, nil)
req.SetBasicAuth("test", "test")
@@ -205,7 +203,7 @@ func TestBasicAuthConcurrentHashOnce(t *testing.T) {
defer res.Body.Close()
assert.Equal(t, http.StatusOK, res.StatusCode, "they should be equal")
}()
})
}
wg.Wait()
-2
View File
@@ -51,8 +51,6 @@ func (eps UDPEntryPoints) Stop() {
for epn, ep := range eps {
wg.Go(func() {
defer wg.Done()
logger := log.With().Str(logs.EntryPointName, epn).Logger()
ep.Shutdown(logger.WithContext(context.Background()))
@@ -560,13 +560,11 @@ func TestConcurrentResponseTimeUpdates(t *testing.T) {
updatesPerGoroutine := 20
for i := range numGoroutines {
wg.Add(1)
go func(id int) {
defer wg.Done()
wg.Go(func() {
for range updatesPerGoroutine {
handler.updateResponseTime(time.Duration(id+1) * time.Millisecond)
handler.updateResponseTime(time.Duration(i+1) * time.Millisecond)
}
}(i)
})
}
wg.Wait()