diff --git a/errgroup/errgroup.go b/errgroup/errgroup.go index 1d8cffa..f69fd75 100644 --- a/errgroup/errgroup.go +++ b/errgroup/errgroup.go
@@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package errgroup provides synchronization, error propagation, and Context -// cancelation for groups of goroutines working on subtasks of a common task. +// cancellation for groups of goroutines working on subtasks of a common task. // // [errgroup.Group] is related to [sync.WaitGroup] but adds handling of tasks // returning errors. @@ -144,8 +144,8 @@ g.sem = nil return } - if len(g.sem) != 0 { - panic(fmt.Errorf("errgroup: modify limit while %v goroutines in the group are still active", len(g.sem))) + if active := len(g.sem); active != 0 { + panic(fmt.Errorf("errgroup: modify limit while %v goroutines in the group are still active", active)) } g.sem = make(chan token, n) }
diff --git a/errgroup/errgroup_test.go b/errgroup/errgroup_test.go index 2a491bf..85008eb 100644 --- a/errgroup/errgroup_test.go +++ b/errgroup/errgroup_test.go
@@ -222,7 +222,7 @@ g.SetLimit(0) for i := 0; i < 1<<10; i++ { if g.TryGo(fn) { - t.Fatalf("TryGo should fail but got succeded.") + t.Fatalf("TryGo should fail but got succeeded.") } } g.Wait()