Skip to content

Commit 17b6e11

Browse files
authored
do not use multiple multi-error packages, pick one (#1058)
1 parent be63fe9 commit 17b6e11

File tree

4 files changed

+11
-20
lines changed

4 files changed

+11
-20
lines changed

dual/dual.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,21 @@ import (
77
"fmt"
88
"sync"
99

10+
"github.com/ipfs/go-cid"
1011
dht "github.com/libp2p/go-libp2p-kad-dht"
1112
"github.com/libp2p/go-libp2p-kad-dht/internal"
12-
"github.com/libp2p/go-libp2p-routing-helpers/tracing"
13-
14-
"github.com/ipfs/go-cid"
1513
kb "github.com/libp2p/go-libp2p-kbucket"
1614
"github.com/libp2p/go-libp2p-kbucket/peerdiversity"
1715
helper "github.com/libp2p/go-libp2p-routing-helpers"
16+
"github.com/libp2p/go-libp2p-routing-helpers/tracing"
1817
ci "github.com/libp2p/go-libp2p/core/crypto"
1918
"github.com/libp2p/go-libp2p/core/host"
2019
"github.com/libp2p/go-libp2p/core/peer"
2120
"github.com/libp2p/go-libp2p/core/protocol"
2221
"github.com/libp2p/go-libp2p/core/routing"
2322
ma "github.com/multiformats/go-multiaddr"
2423
manet "github.com/multiformats/go-multiaddr/net"
25-
26-
"github.com/hashicorp/go-multierror"
24+
"go.uber.org/multierr"
2725
)
2826

2927
const (
@@ -320,7 +318,7 @@ func combineErrors(erra, errb error) error {
320318
} else if errb == kb.ErrLookupFailure {
321319
return erra
322320
}
323-
return multierror.Append(erra, errb).ErrorOrNil()
321+
return multierr.Append(erra, errb)
324322
}
325323

326324
// Bootstrap allows callers to hint to the routing system to get into a

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ go 1.23.0
55
require (
66
github.com/google/gopacket v1.1.19
77
github.com/google/uuid v1.6.0
8-
github.com/hashicorp/go-multierror v1.1.1
98
github.com/hashicorp/golang-lru v1.0.2
109
github.com/ipfs/boxo v0.28.0
1110
github.com/ipfs/go-cid v0.5.0
@@ -17,7 +16,7 @@ require (
1716
github.com/libp2p/go-libp2p v0.41.0
1817
github.com/libp2p/go-libp2p-kbucket v0.6.5
1918
github.com/libp2p/go-libp2p-record v0.3.1
20-
github.com/libp2p/go-libp2p-routing-helpers v0.7.4
19+
github.com/libp2p/go-libp2p-routing-helpers v0.7.5
2120
github.com/libp2p/go-libp2p-testing v0.12.0
2221
github.com/libp2p/go-libp2p-xor v0.1.0
2322
github.com/libp2p/go-msgio v0.3.0
@@ -59,7 +58,6 @@ require (
5958
github.com/gogo/protobuf v1.3.2 // indirect
6059
github.com/google/pprof v0.0.0-20250208200701-d0013a598941 // indirect
6160
github.com/gorilla/websocket v1.5.3 // indirect
62-
github.com/hashicorp/errwrap v1.1.0 // indirect
6361
github.com/huin/goupnp v1.3.0 // indirect
6462
github.com/ipfs/go-block-format v0.2.0 // indirect
6563
github.com/ipfs/go-ipfs-util v0.0.3 // indirect

go.sum

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,6 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb
136136
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
137137
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
138138
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
139-
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
140-
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
141-
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
142-
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
143-
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
144139
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
145140
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
146141
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
@@ -237,8 +232,8 @@ github.com/libp2p/go-libp2p-kbucket v0.6.5/go.mod h1:U6WOd0BvnSp03IQSrjgM54tg7zh
237232
github.com/libp2p/go-libp2p-peerstore v0.1.4/go.mod h1:+4BDbDiiKf4PzpANZDAT+knVdLxvqh7hXOujessqdzs=
238233
github.com/libp2p/go-libp2p-record v0.3.1 h1:cly48Xi5GjNw5Wq+7gmjfBiG9HCzQVkiZOUZ8kUl+Fg=
239234
github.com/libp2p/go-libp2p-record v0.3.1/go.mod h1:T8itUkLcWQLCYMqtX7Th6r7SexyUJpIyPgks757td/E=
240-
github.com/libp2p/go-libp2p-routing-helpers v0.7.4 h1:6LqS1Bzn5CfDJ4tzvP9uwh42IB7TJLNFJA6dEeGBv84=
241-
github.com/libp2p/go-libp2p-routing-helpers v0.7.4/go.mod h1:we5WDj9tbolBXOuF1hGOkR+r7Uh1408tQbAKaT5n1LE=
235+
github.com/libp2p/go-libp2p-routing-helpers v0.7.5 h1:HdwZj9NKovMx0vqq6YNPTh6aaNzey5zHD7HeLJtq6fI=
236+
github.com/libp2p/go-libp2p-routing-helpers v0.7.5/go.mod h1:3YaxrwP0OBPDD7my3D0KxfR89FlcX/IEbxDEDfAmj98=
242237
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
243238
github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
244239
github.com/libp2p/go-libp2p-xor v0.1.0 h1:hhQwT4uGrBcuAkUGXADuPltalOdpf9aag9kaYNT2tLA=

rtrefresh/rt_refresh_manager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"sync/atomic"
88
"time"
99

10-
"github.com/hashicorp/go-multierror"
1110
logging "github.com/ipfs/go-log/v2"
1211
"github.com/libp2p/go-libp2p-kad-dht/internal"
1312
kbucket "github.com/libp2p/go-libp2p-kbucket"
@@ -17,6 +16,7 @@ import (
1716
"go.opentelemetry.io/otel/attribute"
1817
"go.opentelemetry.io/otel/codes"
1918
"go.opentelemetry.io/otel/trace"
19+
"go.uber.org/multierr"
2020
)
2121

2222
var logger = logging.Logger("dht/RtRefreshManager")
@@ -244,7 +244,7 @@ func (r *RtRefreshManager) doRefresh(ctx context.Context, forceRefresh bool) err
244244
var merr error
245245

246246
if err := r.queryForSelf(ctx); err != nil {
247-
merr = multierror.Append(merr, err)
247+
merr = multierr.Append(merr, err)
248248
}
249249

250250
refreshCpls := r.rt.GetTrackedCplsForRefresh()
@@ -261,7 +261,7 @@ func (r *RtRefreshManager) doRefresh(ctx context.Context, forceRefresh bool) err
261261
for c := range refreshCpls {
262262
cpl := uint(c)
263263
if err := rfnc(cpl); err != nil {
264-
merr = multierror.Append(merr, err)
264+
merr = multierr.Append(merr, err)
265265
} else {
266266
// If we see a gap at a Cpl in the Routing table, we ONLY refresh up until the maximum cpl we
267267
// have in the Routing Table OR (2 * (Cpl+ 1) with the gap), whichever is smaller.
@@ -274,7 +274,7 @@ func (r *RtRefreshManager) doRefresh(ctx context.Context, forceRefresh bool) err
274274
lastCpl := min(2*(c+1), len(refreshCpls)-1)
275275
for i := c + 1; i < lastCpl+1; i++ {
276276
if err := rfnc(uint(i)); err != nil {
277-
merr = multierror.Append(merr, err)
277+
merr = multierr.Append(merr, err)
278278
}
279279
}
280280
return merr

0 commit comments

Comments
 (0)