From e7a240395e9e316e35600aa637bae9dcc38f1b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=96=E6=97=B8?= Date: Wed, 23 Jun 2021 18:13:44 +0800 Subject: [PATCH 1/2] uses native errors instead of github.com/pkg/errors --- test/utils/deployment.go | 4 ++-- test/utils/pki_helpers.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/utils/deployment.go b/test/utils/deployment.go index be85879470b..06725c1ba1f 100644 --- a/test/utils/deployment.go +++ b/test/utils/deployment.go @@ -18,11 +18,11 @@ package utils import ( "context" + "errors" "fmt" "time" "github.com/davecgh/go-spew/spew" - "github.com/pkg/errors" apps "k8s.io/api/apps/v1" "k8s.io/api/core/v1" @@ -201,7 +201,7 @@ func WaitForDeploymentRevisionAndImage(c clientset.Interface, ns, deploymentName } if err != nil { if deployment == nil { - return errors.Wrapf(err, "error creating new replica set for deployment %q ", deploymentName) + return fmt.Errorf("error creating new replica set for deployment %q: %w", deploymentName, err) } deploymentImage := "" if len(deployment.Spec.Template.Spec.Containers) > 0 { diff --git a/test/utils/pki_helpers.go b/test/utils/pki_helpers.go index 1c0f1799c67..f944865d772 100644 --- a/test/utils/pki_helpers.go +++ b/test/utils/pki_helpers.go @@ -23,12 +23,11 @@ import ( "crypto/x509" "crypto/x509/pkix" "encoding/pem" + "errors" "math" "math/big" "time" - "github.com/pkg/errors" - certutil "k8s.io/client-go/util/cert" ) From cf07d42337b2231aa22c4be6081c9134fa39b239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=96=E6=97=B8?= Date: Thu, 24 Jun 2021 09:43:09 +0800 Subject: [PATCH 2/2] removes unused libraries --- test/utils/deployment.go | 1 - test/utils/pki_helpers.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/utils/deployment.go b/test/utils/deployment.go index 06725c1ba1f..1977975cc93 100644 --- a/test/utils/deployment.go +++ b/test/utils/deployment.go @@ -18,7 +18,6 @@ package utils import ( "context" - "errors" "fmt" "time" diff --git a/test/utils/pki_helpers.go b/test/utils/pki_helpers.go index f944865d772..06c3290493d 100644 --- a/test/utils/pki_helpers.go +++ b/test/utils/pki_helpers.go @@ -23,7 +23,7 @@ import ( "crypto/x509" "crypto/x509/pkix" "encoding/pem" - "errors" + "fmt" "math" "math/big" "time" @@ -58,10 +58,10 @@ func NewSignedCert(cfg *certutil.Config, key crypto.Signer, caCert *x509.Certifi return nil, err } if len(cfg.CommonName) == 0 { - return nil, errors.New("must specify a CommonName") + return nil, fmt.Errorf("must specify a CommonName") } if len(cfg.Usages) == 0 { - return nil, errors.New("must specify at least one ExtKeyUsage") + return nil, fmt.Errorf("must specify at least one ExtKeyUsage") } certTmpl := x509.Certificate{