MCPcopy Create free account
hub / github.com/git-bug/git-bug / Go

Method Go

util/multierr/errwaitgroup.go:55–70  ·  view source on GitHub ↗

Go calls the given function in a new goroutine. It blocks until the new goroutine can be added without the number of active goroutines in the group exceeding the configured limit.

(f func() error)

Source from the content-addressed store, hash-verified

53// It blocks until the new goroutine can be added without the number of
54// active goroutines in the group exceeding the configured limit.
55func (g *ErrWaitGroup) Go(f func() error) {
56 if g.sem != nil {
57 g.sem <- token{}
58 }
59
60 g.wg.Add(1)
61 go func() {
62 defer g.done()
63
64 if err := f(); err != nil {
65 g.mu.Lock()
66 g.err = Join(g.err, err)
67 g.mu.Unlock()
68 }
69 }()
70}
71
72// TryGo calls the given function in a new goroutine only if the number of
73// active goroutines in the group is currently below the configured limit.

Callers 6

RemoveAllMethod · 0.95
loadMethod · 0.95
CloseMethod · 0.95
OpenGoGitRepoFunction · 0.80
ClockLoaderFunction · 0.80

Calls 4

doneMethod · 0.95
JoinFunction · 0.85
AddMethod · 0.80
LockMethod · 0.65

Tested by

no test coverage detected