From e248b1352d84aa18461689590aa5af5d921fb93c Mon Sep 17 00:00:00 2001 From: Nic Cope Date: Thu, 9 Sep 2021 05:48:38 +0000 Subject: [PATCH] Replace github.com/pkg/errors with our own pkg/errors. Signed-off-by: Nic Cope --- pkg/controller/engine.go | 3 ++- pkg/controller/engine_test.go | 2 +- pkg/fieldpath/fieldpath.go | 2 +- pkg/fieldpath/fieldpath_test.go | 2 +- pkg/fieldpath/merge.go | 2 +- pkg/fieldpath/paved.go | 3 ++- pkg/fieldpath/paved_test.go | 2 +- pkg/meta/meta.go | 2 +- pkg/meta/meta_test.go | 2 +- pkg/parser/linter.go | 3 ++- pkg/parser/linter_test.go | 2 +- pkg/parser/parser.go | 3 ++- pkg/reconciler/managed/api.go | 2 +- pkg/reconciler/managed/api_test.go | 2 +- pkg/reconciler/managed/publisher_test.go | 2 +- pkg/reconciler/managed/reconciler.go | 2 +- pkg/reconciler/managed/reconciler_test.go | 2 +- pkg/reconciler/providerconfig/reconciler.go | 2 +- pkg/reconciler/providerconfig/reconciler_test.go | 2 +- pkg/reference/reference.go | 2 +- pkg/reference/reference_test.go | 2 +- pkg/resource/api.go | 2 +- pkg/resource/api_test.go | 2 +- pkg/resource/predicates_test.go | 2 +- pkg/resource/providerconfig.go | 2 +- pkg/resource/providerconfig_test.go | 2 +- pkg/resource/resource.go | 2 +- pkg/resource/resource_test.go | 5 ++--- pkg/test/integration/server.go | 2 +- 29 files changed, 34 insertions(+), 31 deletions(-) diff --git a/pkg/controller/engine.go b/pkg/controller/engine.go index 4f23b4a6e..9967dd421 100644 --- a/pkg/controller/engine.go +++ b/pkg/controller/engine.go @@ -21,7 +21,6 @@ import ( "context" "sync" - "github.com/pkg/errors" "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" @@ -30,6 +29,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/source" + + "github.com/crossplane/crossplane-runtime/pkg/errors" ) // Error strings diff --git a/pkg/controller/engine_test.go b/pkg/controller/engine_test.go index cc060101a..1abca9f36 100644 --- a/pkg/controller/engine_test.go +++ b/pkg/controller/engine_test.go @@ -22,7 +22,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/controller" @@ -31,6 +30,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/source" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" "github.com/crossplane/crossplane-runtime/pkg/test" ) diff --git a/pkg/fieldpath/fieldpath.go b/pkg/fieldpath/fieldpath.go index c9a592a43..113de2f4a 100644 --- a/pkg/fieldpath/fieldpath.go +++ b/pkg/fieldpath/fieldpath.go @@ -48,7 +48,7 @@ import ( "strings" "unicode/utf8" - "github.com/pkg/errors" + "github.com/crossplane/crossplane-runtime/pkg/errors" ) // A SegmentType within a field path; either a field within an object, or an diff --git a/pkg/fieldpath/fieldpath_test.go b/pkg/fieldpath/fieldpath_test.go index ed77b22bb..cd910b723 100644 --- a/pkg/fieldpath/fieldpath_test.go +++ b/pkg/fieldpath/fieldpath_test.go @@ -22,8 +22,8 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/test" ) diff --git a/pkg/fieldpath/merge.go b/pkg/fieldpath/merge.go index e8c9517c5..8e33ec678 100644 --- a/pkg/fieldpath/merge.go +++ b/pkg/fieldpath/merge.go @@ -20,9 +20,9 @@ import ( "reflect" "github.com/imdario/mergo" - "github.com/pkg/errors" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" ) const ( diff --git a/pkg/fieldpath/paved.go b/pkg/fieldpath/paved.go index 184e41dbe..2a2629b75 100644 --- a/pkg/fieldpath/paved.go +++ b/pkg/fieldpath/paved.go @@ -17,9 +17,10 @@ limitations under the License. package fieldpath import ( - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/json" + + "github.com/crossplane/crossplane-runtime/pkg/errors" ) type errNotFound struct { diff --git a/pkg/fieldpath/paved_test.go b/pkg/fieldpath/paved_test.go index fbe998030..fd0e93925 100644 --- a/pkg/fieldpath/paved_test.go +++ b/pkg/fieldpath/paved_test.go @@ -20,11 +20,11 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/json" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/test" ) diff --git a/pkg/meta/meta.go b/pkg/meta/meta.go index cdc96e50d..d6e56f47d 100644 --- a/pkg/meta/meta.go +++ b/pkg/meta/meta.go @@ -23,13 +23,13 @@ import ( "strings" "time" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" ) const ( diff --git a/pkg/meta/meta_test.go b/pkg/meta/meta_test.go index 8f0ffadd8..61e784d31 100644 --- a/pkg/meta/meta_test.go +++ b/pkg/meta/meta_test.go @@ -23,13 +23,13 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/test" ) diff --git a/pkg/parser/linter.go b/pkg/parser/linter.go index ea2c27c0c..7fbd21cd5 100644 --- a/pkg/parser/linter.go +++ b/pkg/parser/linter.go @@ -17,8 +17,9 @@ limitations under the License. package parser import ( - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" + + "github.com/crossplane/crossplane-runtime/pkg/errors" ) const ( diff --git a/pkg/parser/linter_test.go b/pkg/parser/linter_test.go index d929b4dc0..1bcd6b601 100644 --- a/pkg/parser/linter_test.go +++ b/pkg/parser/linter_test.go @@ -20,9 +20,9 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/test" ) diff --git a/pkg/parser/parser.go b/pkg/parser/parser.go index 97bbf2b85..20725a902 100644 --- a/pkg/parser/parser.go +++ b/pkg/parser/parser.go @@ -25,13 +25,14 @@ import ( "strings" "unicode" - "github.com/pkg/errors" "github.com/spf13/afero" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer/json" "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/client-go/kubernetes" + + "github.com/crossplane/crossplane-runtime/pkg/errors" ) // AnnotatedReadCloser is a wrapper around io.ReadCloser that allows diff --git a/pkg/reconciler/managed/api.go b/pkg/reconciler/managed/api.go index 5281d2afc..1669dc89a 100644 --- a/pkg/reconciler/managed/api.go +++ b/pkg/reconciler/managed/api.go @@ -20,13 +20,13 @@ import ( "context" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/retry" "sigs.k8s.io/controller-runtime/pkg/client" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/resource" ) diff --git a/pkg/reconciler/managed/api_test.go b/pkg/reconciler/managed/api_test.go index 650273759..9cb7890d1 100644 --- a/pkg/reconciler/managed/api_test.go +++ b/pkg/reconciler/managed/api_test.go @@ -21,12 +21,12 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/client" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" diff --git a/pkg/reconciler/managed/publisher_test.go b/pkg/reconciler/managed/publisher_test.go index cf94ec012..7d9af5bf3 100644 --- a/pkg/reconciler/managed/publisher_test.go +++ b/pkg/reconciler/managed/publisher_test.go @@ -21,8 +21,8 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" "github.com/crossplane/crossplane-runtime/pkg/test" diff --git a/pkg/reconciler/managed/reconciler.go b/pkg/reconciler/managed/reconciler.go index 28ba82213..f639380ac 100644 --- a/pkg/reconciler/managed/reconciler.go +++ b/pkg/reconciler/managed/reconciler.go @@ -21,13 +21,13 @@ import ( "strings" "time" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime/schema" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/reconcile" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/event" "github.com/crossplane/crossplane-runtime/pkg/logging" "github.com/crossplane/crossplane-runtime/pkg/meta" diff --git a/pkg/reconciler/managed/reconciler_test.go b/pkg/reconciler/managed/reconciler_test.go index 5f67f66f0..f71125490 100644 --- a/pkg/reconciler/managed/reconciler_test.go +++ b/pkg/reconciler/managed/reconciler_test.go @@ -27,12 +27,12 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/reconcile" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" diff --git a/pkg/reconciler/providerconfig/reconciler.go b/pkg/reconciler/providerconfig/reconciler.go index 58568e99d..12e54f4bd 100644 --- a/pkg/reconciler/providerconfig/reconciler.go +++ b/pkg/reconciler/providerconfig/reconciler.go @@ -21,7 +21,6 @@ import ( "strings" "time" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" @@ -29,6 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/event" "github.com/crossplane/crossplane-runtime/pkg/logging" "github.com/crossplane/crossplane-runtime/pkg/meta" diff --git a/pkg/reconciler/providerconfig/reconciler_test.go b/pkg/reconciler/providerconfig/reconciler_test.go index 8991075b5..2bdc0a71a 100644 --- a/pkg/reconciler/providerconfig/reconciler_test.go +++ b/pkg/reconciler/providerconfig/reconciler_test.go @@ -22,7 +22,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -32,6 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/reconcile" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" "github.com/crossplane/crossplane-runtime/pkg/test" diff --git a/pkg/reference/reference.go b/pkg/reference/reference.go index 82dc8569b..06396e827 100644 --- a/pkg/reference/reference.go +++ b/pkg/reference/reference.go @@ -19,11 +19,11 @@ package reference import ( "context" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/resource" ) diff --git a/pkg/reference/reference_test.go b/pkg/reference/reference_test.go index ca774e7a8..ec034138c 100644 --- a/pkg/reference/reference_test.go +++ b/pkg/reference/reference_test.go @@ -22,12 +22,12 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" diff --git a/pkg/resource/api.go b/pkg/resource/api.go index 4ad3430ed..7c77e2a0b 100644 --- a/pkg/resource/api.go +++ b/pkg/resource/api.go @@ -20,7 +20,6 @@ import ( "context" "encoding/json" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -28,6 +27,7 @@ import ( "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" ) diff --git a/pkg/resource/api_test.go b/pkg/resource/api_test.go index faa0e98c0..f8b52e33c 100644 --- a/pkg/resource/api_test.go +++ b/pkg/resource/api_test.go @@ -21,7 +21,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -30,6 +29,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" "github.com/crossplane/crossplane-runtime/pkg/test" diff --git a/pkg/resource/predicates_test.go b/pkg/resource/predicates_test.go index 415f3eb2b..3001a7750 100644 --- a/pkg/resource/predicates_test.go +++ b/pkg/resource/predicates_test.go @@ -20,12 +20,12 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" ) diff --git a/pkg/resource/providerconfig.go b/pkg/resource/providerconfig.go index 9b6d1dcc4..5f15978dc 100644 --- a/pkg/resource/providerconfig.go +++ b/pkg/resource/providerconfig.go @@ -20,7 +20,6 @@ import ( "context" "os" - "github.com/pkg/errors" "github.com/spf13/afero" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -29,6 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" ) diff --git a/pkg/resource/providerconfig_test.go b/pkg/resource/providerconfig_test.go index edc1bf1bd..eb973bb6f 100644 --- a/pkg/resource/providerconfig_test.go +++ b/pkg/resource/providerconfig_test.go @@ -21,12 +21,12 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" "github.com/spf13/afero" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" "github.com/crossplane/crossplane-runtime/pkg/test" ) diff --git a/pkg/resource/resource.go b/pkg/resource/resource.go index a0a8d3b42..0e706603d 100644 --- a/pkg/resource/resource.go +++ b/pkg/resource/resource.go @@ -20,7 +20,6 @@ import ( "context" "strings" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -32,6 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/meta" ) diff --git a/pkg/resource/resource_test.go b/pkg/resource/resource_test.go index 42be55246..2a83b5fe0 100644 --- a/pkg/resource/resource_test.go +++ b/pkg/resource/resource_test.go @@ -22,8 +22,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -35,6 +33,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/resource/fake" "github.com/crossplane/crossplane-runtime/pkg/test" ) @@ -822,7 +821,7 @@ func TestApplicatorWithRetry_Apply(t *testing.T) { backoff: tc.fields.backoff, } - if diff := cmp.Diff(tc.wantErr, awr.Apply(tc.args.ctx, tc.args.c, tc.args.opts...), cmpopts.EquateErrors()); diff != "" { + if diff := cmp.Diff(tc.wantErr, awr.Apply(tc.args.ctx, tc.args.c, tc.args.opts...), test.EquateErrors()); diff != "" { t.Fatalf("ApplicatorWithRetry.Apply(...): -want, +got:\n%s", diff) } diff --git a/pkg/test/integration/server.go b/pkg/test/integration/server.go index c47bcdf8b..4ab3b615c 100644 --- a/pkg/test/integration/server.go +++ b/pkg/test/integration/server.go @@ -22,7 +22,6 @@ import ( "os" "time" - "github.com/pkg/errors" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/rest" @@ -33,6 +32,7 @@ import ( // Allow auth to cloud providers _ "k8s.io/client-go/plugin/pkg/client/auth" + "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/resource" )