From f9a863f22093e2729223252e47eff52654bd197f Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Thu, 7 May 2026 10:38:14 -0700 Subject: [PATCH] replace some usages of github.com/pkg/errors Signed-off-by: Ryan Richard --- internal/admissionpluginconfig/admissionpluginconfig.go | 2 +- internal/controller/tlsconfigutil/tls_config_util.go | 7 +++---- .../federationdomain/endpoints/token/token_handler_test.go | 2 +- internal/fositestorage/accesstoken/accesstoken_test.go | 2 +- .../authorizationcode/authorizationcode_test.go | 2 +- internal/fositestorage/openidconnect/openidconnect_test.go | 4 ++-- internal/fositestorage/pkce/pkce_test.go | 4 ++-- internal/fositestorage/refreshtoken/refreshtoken_test.go | 2 +- internal/tokenclient/tokenclient.go | 7 ++++--- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/admissionpluginconfig/admissionpluginconfig.go b/internal/admissionpluginconfig/admissionpluginconfig.go index 29eca19ae..fe89b6c5e 100644 --- a/internal/admissionpluginconfig/admissionpluginconfig.go +++ b/internal/admissionpluginconfig/admissionpluginconfig.go @@ -4,10 +4,10 @@ package admissionpluginconfig import ( + "errors" "fmt" "slices" - "github.com/pkg/errors" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" mutatingadmissionpolicy "k8s.io/apiserver/pkg/admission/plugin/policy/mutating" diff --git a/internal/controller/tlsconfigutil/tls_config_util.go b/internal/controller/tlsconfigutil/tls_config_util.go index 2c783db6d..522a33738 100644 --- a/internal/controller/tlsconfigutil/tls_config_util.go +++ b/internal/controller/tlsconfigutil/tls_config_util.go @@ -1,4 +1,4 @@ -// Copyright 2024 the Pinniped contributors. All Rights Reserved. +// Copyright 2024-2026 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package tlsconfigutil @@ -8,7 +8,6 @@ import ( "fmt" "strings" - "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" corev1informers "k8s.io/client-go/informers/core/v1" @@ -201,7 +200,7 @@ func readCABundleFromK8sSecret(namespace string, name string, key string, secret s, err := secretInformer.Lister().Secrets(namespace).Get(name) if err != nil { - return "", errors.Wrapf(err, "failed to get secret %q", namespacedName) + return "", fmt.Errorf("failed to get secret %q: %w", namespacedName, err) } // For Secrets to be used as a certificate authority data source, the secret should be of type @@ -225,7 +224,7 @@ func readCABundleFromK8sConfigMap(namespace string, name string, key string, con c, err := configMapInformer.Lister().ConfigMaps(namespace).Get(name) if err != nil { - return "", errors.Wrapf(err, "failed to get configmap %q", namespacedName) + return "", fmt.Errorf("failed to get configmap %q: %w", namespacedName, err) } val, exists := c.Data[key] diff --git a/internal/federationdomain/endpoints/token/token_handler_test.go b/internal/federationdomain/endpoints/token/token_handler_test.go index 76d742863..091ca93a9 100644 --- a/internal/federationdomain/endpoints/token/token_handler_test.go +++ b/internal/federationdomain/endpoints/token/token_handler_test.go @@ -13,6 +13,7 @@ import ( "encoding/base32" "encoding/base64" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -30,7 +31,6 @@ import ( "github.com/ory/fosite/handler/openid" fositepkce "github.com/ory/fosite/handler/pkce" fositejwt "github.com/ory/fosite/token/jwt" - "github.com/pkg/errors" "github.com/stretchr/testify/require" "golang.org/x/crypto/bcrypt" "golang.org/x/oauth2" diff --git a/internal/fositestorage/accesstoken/accesstoken_test.go b/internal/fositestorage/accesstoken/accesstoken_test.go index 48d19191c..dd2853789 100644 --- a/internal/fositestorage/accesstoken/accesstoken_test.go +++ b/internal/fositestorage/accesstoken/accesstoken_test.go @@ -5,6 +5,7 @@ package accesstoken import ( "context" + "errors" "net/url" "testing" "time" @@ -12,7 +13,6 @@ import ( "github.com/ory/fosite" "github.com/ory/fosite/handler/openid" fositejwt "github.com/ory/fosite/token/jwt" - "github.com/pkg/errors" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/internal/fositestorage/authorizationcode/authorizationcode_test.go b/internal/fositestorage/authorizationcode/authorizationcode_test.go index 2c1c62a90..d99898b53 100644 --- a/internal/fositestorage/authorizationcode/authorizationcode_test.go +++ b/internal/fositestorage/authorizationcode/authorizationcode_test.go @@ -8,6 +8,7 @@ import ( "crypto/ed25519" "crypto/x509" "encoding/json" + "errors" "fmt" "math/rand" "net/url" @@ -21,7 +22,6 @@ import ( fositeoauth2 "github.com/ory/fosite/handler/oauth2" "github.com/ory/fosite/handler/openid" fositejwt "github.com/ory/fosite/token/jwt" - "github.com/pkg/errors" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" diff --git a/internal/fositestorage/openidconnect/openidconnect_test.go b/internal/fositestorage/openidconnect/openidconnect_test.go index b4b3094b0..8b3e4e475 100644 --- a/internal/fositestorage/openidconnect/openidconnect_test.go +++ b/internal/fositestorage/openidconnect/openidconnect_test.go @@ -1,17 +1,17 @@ -// Copyright 2020-2025 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2026 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package openidconnect import ( "context" + "errors" "net/url" "testing" "time" "github.com/ory/fosite" "github.com/ory/fosite/handler/openid" - "github.com/pkg/errors" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/internal/fositestorage/pkce/pkce_test.go b/internal/fositestorage/pkce/pkce_test.go index 98ed1b1e1..1dbd9023f 100644 --- a/internal/fositestorage/pkce/pkce_test.go +++ b/internal/fositestorage/pkce/pkce_test.go @@ -1,17 +1,17 @@ -// Copyright 2020-2025 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2026 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package pkce import ( "context" + "errors" "net/url" "testing" "time" "github.com/ory/fosite" "github.com/ory/fosite/handler/pkce" - "github.com/pkg/errors" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/internal/fositestorage/refreshtoken/refreshtoken_test.go b/internal/fositestorage/refreshtoken/refreshtoken_test.go index 1fd11c91e..fcba4c3c0 100644 --- a/internal/fositestorage/refreshtoken/refreshtoken_test.go +++ b/internal/fositestorage/refreshtoken/refreshtoken_test.go @@ -5,6 +5,7 @@ package refreshtoken import ( "context" + "errors" "net/url" "testing" "time" @@ -12,7 +13,6 @@ import ( "github.com/ory/fosite" "github.com/ory/fosite/handler/openid" fositejwt "github.com/ory/fosite/token/jwt" - "github.com/pkg/errors" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/internal/tokenclient/tokenclient.go b/internal/tokenclient/tokenclient.go index a6d27e68b..d831f10bc 100644 --- a/internal/tokenclient/tokenclient.go +++ b/internal/tokenclient/tokenclient.go @@ -1,13 +1,14 @@ -// Copyright 2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2023-2026 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package tokenclient import ( "context" + "errors" + "fmt" "time" - "github.com/pkg/errors" authenticationv1 "k8s.io/api/authentication/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" corev1client "k8s.io/client-go/kubernetes/typed/core/v1" @@ -122,7 +123,7 @@ func (tc TokenClient) fetchToken(ctx context.Context) (token string, ttl time.Du ) if err != nil { - return "", 0, errors.Wrap(err, "error creating token") + return "", 0, fmt.Errorf("error creating token: %w", err) } if tokenResponse == nil {