diff --git a/client/rpc/api_test.go b/client/rpc/api_test.go index dd1e1db04..745f0fe13 100644 --- a/client/rpc/api_test.go +++ b/client/rpc/api_test.go @@ -2,6 +2,7 @@ package rpc import ( "context" + "errors" "net/http" "net/http/httptest" "strconv" @@ -16,7 +17,6 @@ import ( "github.com/ipfs/kubo/core/coreiface/tests" "github.com/ipfs/kubo/test/cli/harness" ma "github.com/multiformats/go-multiaddr" - "go.uber.org/multierr" ) type NodeProvider struct{} @@ -91,7 +91,7 @@ func (np NodeProvider) MakeAPISwarm(t *testing.T, ctx context.Context, fullIdent wg.Wait() - return apis, multierr.Combine(errs...) + return apis, errors.Join(errs...) } func TestHttpApi(t *testing.T) { diff --git a/cmd/ipfs/kubo/daemon.go b/cmd/ipfs/kubo/daemon.go index e52e68906..eb8b23a97 100644 --- a/cmd/ipfs/kubo/daemon.go +++ b/cmd/ipfs/kubo/daemon.go @@ -44,7 +44,6 @@ import ( manet "github.com/multiformats/go-multiaddr/net" prometheus "github.com/prometheus/client_golang/prometheus" promauto "github.com/prometheus/client_golang/prometheus/promauto" - "go.uber.org/multierr" ) const ( @@ -725,14 +724,17 @@ take effect. // collect long-running errors and block for shutdown // TODO(cryptix): our fuse currently doesn't follow this pattern for graceful shutdown - var errs error + var errs []error for err := range merge(apiErrc, gwErrc, gcErrc, p2pGwErrc, pluginErrc, unmountErrc) { if err != nil { - errs = multierr.Append(errs, err) + errs = append(errs, err) } } + if len(errs) != 0 { + return errors.Join(errs...) + } - return errs + return nil } // serveHTTPApi collects options, creates listener, prints status message and starts serving requests. diff --git a/go.mod b/go.mod index 2e75ec217..8dc71c2da 100644 --- a/go.mod +++ b/go.mod @@ -83,7 +83,6 @@ require ( go.opentelemetry.io/otel/trace v1.37.0 go.uber.org/dig v1.19.0 go.uber.org/fx v1.24.0 - go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 golang.org/x/crypto v0.41.0 golang.org/x/exp v0.0.0-20250811191247-51f88131bc50 @@ -247,6 +246,7 @@ require ( go.opentelemetry.io/otel/metric v1.37.0 // indirect go.opentelemetry.io/proto/otlp v1.7.0 // indirect go.uber.org/mock v0.5.2 // indirect + go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap/exp v0.3.0 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect golang.org/x/net v0.43.0 // indirect diff --git a/repo/fsrepo/migrations/fetcher.go b/repo/fsrepo/migrations/fetcher.go index c81554c3c..cc48a3b77 100644 --- a/repo/fsrepo/migrations/fetcher.go +++ b/repo/fsrepo/migrations/fetcher.go @@ -2,11 +2,10 @@ package migrations import ( "context" + "errors" "fmt" "io" "os" - - "go.uber.org/multierr" ) const ( @@ -49,23 +48,23 @@ func NewMultiFetcher(f ...Fetcher) *MultiFetcher { // Fetch attempts to fetch the file at each of its fetchers until one succeeds. func (f *MultiFetcher) Fetch(ctx context.Context, ipfsPath string) ([]byte, error) { - var errs error + var errs []error for _, fetcher := range f.fetchers { out, err := fetcher.Fetch(ctx, ipfsPath) if err == nil { return out, nil } fmt.Printf("Error fetching: %s\n", err.Error()) - errs = multierr.Append(errs, err) + errs = append(errs, err) } - return nil, errs + return nil, errors.Join(errs...) } func (f *MultiFetcher) Close() error { var errs error for _, fetcher := range f.fetchers { if err := fetcher.Close(); err != nil { - errs = multierr.Append(errs, err) + errs = errors.Join(errs, err) } } return errs diff --git a/routing/composer.go b/routing/composer.go index a100bb498..500fa371e 100644 --- a/routing/composer.go +++ b/routing/composer.go @@ -9,7 +9,6 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/routing" "github.com/multiformats/go-multihash" - "go.uber.org/multierr" ) var ( @@ -124,7 +123,7 @@ func (c *Composer) Bootstrap(ctx context.Context) error { errgv := c.GetValueRouter.Bootstrap(ctx) errpv := c.PutValueRouter.Bootstrap(ctx) errp := c.ProvideRouter.Bootstrap(ctx) - err := multierr.Combine(errfp, errfps, errgv, errpv, errp) + err := errors.Join(errfp, errfps, errgv, errpv, errp) if err != nil { log.Debug("composer: calling bootstrap error: ", err) }