From 73b2af2c1bbc7809d47bc0c7a2a19cf01fc48a64 Mon Sep 17 00:00:00 2001 From: Fish-pro Date: Thu, 5 Jan 2023 11:39:41 +0800 Subject: [PATCH] fix: Remove dependency on github.com/pkg/errors Signed-off-by: Fish-pro --- go.mod | 2 +- server/server.go | 3 +-- util/kube/portforwarder.go | 3 +-- util/kustomize/kustomize.go | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index eefb7bf95f269..f26a3f505bf6e 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/mattn/go-zglob v0.0.4 github.com/olekukonko/tablewriter v0.0.5 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/pkg/errors v0.9.1 + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.14.0 github.com/r3labs/diff v1.1.0 github.com/rs/cors v1.8.0 // indirect diff --git a/server/server.go b/server/server.go index c67a816c16d54..750e8c04369eb 100644 --- a/server/server.go +++ b/server/server.go @@ -4,6 +4,7 @@ import ( "context" netCtx "context" "crypto/tls" + "errors" "fmt" goio "io" "io/fs" @@ -61,8 +62,6 @@ import ( accountpkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/account" applicationpkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/application" - "github.com/pkg/errors" - applicationsetpkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/applicationset" certificatepkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/certificate" clusterpkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/cluster" diff --git a/util/kube/portforwarder.go b/util/kube/portforwarder.go index c661cb6f850a7..1ea6e0fdadbef 100644 --- a/util/kube/portforwarder.go +++ b/util/kube/portforwarder.go @@ -8,7 +8,6 @@ import ( "net/http" "os" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" @@ -68,7 +67,7 @@ func PortForward(targetPort int, namespace string, overrides *clientcmd.ConfigOv transport, upgrader, err := spdy.RoundTripperFor(config) if err != nil { - return -1, errors.Wrap(err, "Could not create round tripper") + return -1, fmt.Errorf("could not create round tripper: %w", err) } dialer := spdy.NewDialer(upgrader, &http.Client{Transport: transport}, "POST", url) diff --git a/util/kustomize/kustomize.go b/util/kustomize/kustomize.go index cff45b88f61a0..ff2cf3b8e8867 100644 --- a/util/kustomize/kustomize.go +++ b/util/kustomize/kustomize.go @@ -1,6 +1,7 @@ package kustomize import ( + "errors" "fmt" "net/url" "os" @@ -14,7 +15,6 @@ import ( "github.com/Masterminds/semver/v3" "github.com/argoproj/gitops-engine/pkg/utils/kube" - "github.com/pkg/errors" log "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -258,7 +258,7 @@ func getSemver() (*semver.Version, error) { // getSemverSafe returns parsed kustomize version; // if version cannot be parsed assumes that "kustomize version" output format changed again -// and fallback to latest ( v99.99.99 ) +// and fallback to latest ( v99.99.99 ) func getSemverSafe() *semver.Version { if semVer == nil { semVerLock.Lock()