We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0de741c commit 51b7016Copy full SHA for 51b7016
errgroup/errgroup.go
@@ -121,12 +121,12 @@ func (g *Group) TryGo(f func() error) bool {
121
//
122
// The limit must not be modified while any goroutines in the group are active.
123
func (g *Group) SetLimit(n int) {
124
+ if len(g.sem) != 0 {
125
+ panic(fmt.Errorf("errgroup: modify limit while %v goroutines in the group are still active", len(g.sem)))
126
+ }
127
if n < 0 {
128
g.sem = nil
129
return
130
}
- if len(g.sem) != 0 {
- panic(fmt.Errorf("errgroup: modify limit while %v goroutines in the group are still active", len(g.sem)))
- }
131
g.sem = make(chan token, n)
132
0 commit comments