internal: remove pkg/errors
This commit is contained in:
parent
94a9667d86
commit
41eb44137e
1
go.mod
1
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Reference in New Issue