diff --git a/go.mod b/go.mod index dc36eb5..c49d110 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,6 @@ module github.com/grpc-ecosystem/go-grpc-prometheus require ( github.com/golang/protobuf v1.2.0 - github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v0.9.2 github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 github.com/stretchr/testify v1.3.0 diff --git a/go.sum b/go.sum index 045a541..485e90a 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,6 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.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/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= diff --git a/server_test.go b/server_test.go index 7e0d0d2..0991571 100644 --- a/server_test.go +++ b/server_test.go @@ -7,7 +7,6 @@ import ( "bufio" "context" "fmt" - "github.com/pkg/errors" "io" "net" "net/http" @@ -252,11 +251,22 @@ func (s *testService) Ping(ctx context.Context, ping *pb_testproto.PingRequest) return &pb_testproto.PingResponse{Value: ping.Value, Counter: 42}, nil } + +// Own implementation of pkg/errors withStack to avoid additional dependency +type wrappedError struct { + cause error + msg string +} + +func (w *wrappedError) Error() string { return w.msg + ": " + w.cause.Error() } + +func (w *wrappedError) Cause() error { return w.cause } + func (s *testService) PingError(ctx context.Context, ping *pb_testproto.PingRequest) (*pb_testproto.Empty, error) { code := codes.Code(ping.ErrorCodeReturned) err := status.Errorf(code, "Userspace error.") if ping.Value == "wrapf" { - err = errors.Wrapf(err, "wrapped error") + err = &wrappedError{cause: err} } //if ping.Value == "errorf" { // err = fmt.Errorf("wrapped error: %w", err)