From 41eb44137e518568808bffda961bcc525fe00fbf Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 5 Jul 2022 20:26:33 +0000 Subject: [PATCH] internal: remove pkg/errors --- go.mod | 1 - internal/config/config.go | 12 ++++++------ internal/outpost/proxyv2/application/application.go | 5 ++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index cd0858699..81dcc1068 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,6 @@ require ( github.com/nmcclain/asn1-ber v0.0.0-20170104154839-2661553a0484 github.com/nmcclain/ldap v0.0.0-20210720162743-7f8d1e44eeba github.com/pires/go-proxyproto v0.6.2 - github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.12.2 github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b github.com/sirupsen/logrus v1.8.1 diff --git a/internal/config/config.go b/internal/config/config.go index 72cfe0053..5e98718ce 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1,12 +1,12 @@ package config import ( + "fmt" "io/ioutil" "strings" env "github.com/Netflix/go-env" "github.com/imdario/mergo" - "github.com/pkg/errors" log "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" ) @@ -35,15 +35,15 @@ func DefaultConfig() { func LoadConfig(path string) error { raw, err := ioutil.ReadFile(path) if err != nil { - return errors.Wrap(err, "Failed to load config file") + return fmt.Errorf("Failed to load config file: %w", err) } nc := Config{} err = yaml.Unmarshal(raw, &nc) if err != nil { - return errors.Wrap(err, "Failed to parse YAML") + return fmt.Errorf("Failed to parse YAML: %w", err) } if err := mergo.Merge(&G, nc, mergo.WithOverride); err != nil { - return errors.Wrap(err, "failed to overlay config") + return fmt.Errorf("failed to overlay config: %w", err) } log.WithField("path", path).Debug("Loaded config") return nil @@ -53,10 +53,10 @@ func FromEnv() error { nc := Config{} _, err := env.UnmarshalFromEnviron(&nc) if err != nil { - return errors.Wrap(err, "failed to load environment variables") + return fmt.Errorf("failed to load environment variables: %w", err) } if err := mergo.Merge(&G, nc, mergo.WithOverride); err != nil { - return errors.Wrap(err, "failed to overlay config") + return fmt.Errorf("failed to overlay config: %w", err) } log.Debug("Loaded config from environment") return nil diff --git a/internal/outpost/proxyv2/application/application.go b/internal/outpost/proxyv2/application/application.go index a127a2ba2..6b0052d6b 100644 --- a/internal/outpost/proxyv2/application/application.go +++ b/internal/outpost/proxyv2/application/application.go @@ -17,7 +17,6 @@ import ( sentryhttp "github.com/getsentry/sentry-go/http" "github.com/gorilla/mux" "github.com/gorilla/sessions" - "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" log "github.com/sirupsen/logrus" "goauthentik.io/api/v3" @@ -155,13 +154,13 @@ func NewApplication(p api.ProxyOutpostConfig, c *http.Client, cs *ak.CryptoStore err = a.configureForward() } if err != nil { - return nil, errors.Wrap(err, "failed to configure application mode") + return nil, fmt.Errorf("failed to configure application mode: %w", err) } if kp := p.Certificate.Get(); kp != nil { err := cs.AddKeypair(*kp) if err != nil { - return nil, errors.Wrap(err, "failed to initially fetch certificate") + return nil, fmt.Errorf("failed to initially fetch certificate: %w", err) } a.Cert = cs.Get(*kp) }