From a46f798831df06c472b288db7b34de8536a7ea5a Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Wed, 6 Jul 2022 09:48:36 +0200 Subject: pkg: switch to golang native error wrapping We now use the golang error wrapping format specifier `%w` instead of the deprecated github.com/pkg/errors package. [NO NEW TESTS NEEDED] Signed-off-by: Sascha Grunert --- pkg/api/server/listener_api.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'pkg/api/server') diff --git a/pkg/api/server/listener_api.go b/pkg/api/server/listener_api.go index aaaf6688e..d1f3ea7a3 100644 --- a/pkg/api/server/listener_api.go +++ b/pkg/api/server/listener_api.go @@ -1,11 +1,10 @@ package server import ( + "fmt" "net" "os" "path/filepath" - - "github.com/pkg/errors" ) // ListenUnix follows stdlib net.Listen() API, providing a unix listener for given path @@ -14,18 +13,18 @@ func ListenUnix(network string, path string) (net.Listener, error) { // set up custom listener for API server err := os.MkdirAll(filepath.Dir(path), 0770) if err != nil { - return nil, errors.Wrapf(err, "api.ListenUnix() failed to create %s", filepath.Dir(path)) + return nil, fmt.Errorf("api.ListenUnix() failed to create %s: %w", filepath.Dir(path), err) } os.Remove(path) listener, err := net.Listen(network, path) if err != nil { - return nil, errors.Wrapf(err, "api.ListenUnix() failed to create net.Listen(%s, %s)", network, path) + return nil, fmt.Errorf("api.ListenUnix() failed to create net.Listen(%s, %s): %w", network, path, err) } _, err = os.Stat(path) if err != nil { - return nil, errors.Wrapf(err, "net.Listen(%s, %s) failed to report the failure to create socket", network, path) + return nil, fmt.Errorf("net.Listen(%s, %s) failed to report the failure to create socket: %w", network, path, err) } return listener, nil -- cgit v1.2.3-54-g00ecf