diff --git a/go.mod b/go.mod index a1d18fc..04aea24 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/libp2p/go-reuseport go 1.16 require ( - github.com/pkg/errors v0.9.1 - github.com/stretchr/testify v1.5.1 + github.com/stretchr/testify v1.7.0 golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e ) diff --git a/go.sum b/go.sum index eadf4d4..9534099 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,13 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/interface.go b/interface.go index 64b48af..db6163a 100644 --- a/interface.go +++ b/interface.go @@ -19,9 +19,8 @@ package reuseport import ( "context" + "fmt" "net" - - "github.com/pkg/errors" ) // Available returns whether or not SO_REUSEPORT or equivalent behaviour is @@ -54,7 +53,7 @@ func ListenPacket(network, address string) (net.PacketConn, error) { func Dial(network, laddr, raddr string) (net.Conn, error) { nla, err := ResolveAddr(network, laddr) if err != nil { - return nil, errors.Wrap(err, "resolving local addr") + return nil, fmt.Errorf("failed to resolve local addr: %w", err) } d := net.Dialer{ Control: Control, diff --git a/reuse_test.go b/reuse_test.go index 883f89e..7c8006f 100644 --- a/reuse_test.go +++ b/reuse_test.go @@ -6,9 +6,6 @@ import ( "strings" "testing" - "github.com/pkg/errors" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) @@ -49,7 +46,7 @@ func TestListenPacketWildcardAddress(t *testing.T) { func TestErrorWhenDialUnresolvable(t *testing.T) { _, err := Dial("asd", "127.0.0.1:1234", "127.0.0.1:1234") - assert.IsType(t, net.UnknownNetworkError(""), errors.Cause(err)) + require.ErrorIs(t, err, net.UnknownNetworkError("asd")) _, err = Dial("tcp", "a.b.c.d:1234", "a.b.c.d:1235") - assert.Error(t, err) + require.Error(t, err) }