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/env/env.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'pkg/env') diff --git a/pkg/env/env.go b/pkg/env/env.go index 5989d0da5..8af9fd77c 100644 --- a/pkg/env/env.go +++ b/pkg/env/env.go @@ -8,8 +8,6 @@ import ( "fmt" "os" "strings" - - "github.com/pkg/errors" ) const whiteSpaces = " \t" @@ -56,7 +54,7 @@ func ParseFile(path string) (_ map[string]string, err error) { env := make(map[string]string) defer func() { if err != nil { - err = errors.Wrapf(err, "error parsing env file %q", path) + err = fmt.Errorf("error parsing env file %q: %w", path, err) } }() @@ -85,12 +83,12 @@ func parseEnv(env map[string]string, line string) error { // catch invalid variables such as "=" or "=A" if data[0] == "" { - return errors.Errorf("invalid environment variable: %q", line) + return fmt.Errorf("invalid environment variable: %q", line) } // trim the front of a variable, but nothing else name := strings.TrimLeft(data[0], whiteSpaces) if strings.ContainsAny(name, whiteSpaces) { - return errors.Errorf("name %q has white spaces, poorly formatted name", name) + return fmt.Errorf("name %q has white spaces, poorly formatted name", name) } if len(data) > 1 { -- cgit v1.2.3-54-g00ecf