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

Function Join

util/multierr/join.go:13–32  ·  view source on GitHub ↗

Copyright 2022 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. Join returns an error that wraps the given errors. Any nil error values are discarded. Join returns nil if errs contains no non-nil values. The error

(errs ...error)

Source from the content-addressed store, hash-verified

11// by calling the Error method of each element of errs, with a newline
12// between each string.
13func Join(errs ...error) error {
14 n := 0
15 for _, err := range errs {
16 if err != nil {
17 n++
18 }
19 }
20 if n == 0 {
21 return nil
22 }
23 e := &joinError{
24 errs: make([]error, 0, n),
25 }
26 for _, err := range errs {
27 if err != nil {
28 e.errs = append(e.errs, err)
29 }
30 }
31 return e
32}
33
34type joinError struct {
35 errs []error

Callers 2

GoMethod · 0.85
TryGoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected