Skip to content

Commit da8cd19

Browse files
committed
chore: remove direct dependency to github.com/pkg/errors
1 parent e2ec175 commit da8cd19

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ require (
3838
github.com/onsi/ginkgo/v2 v2.19.0
3939
github.com/onsi/gomega v1.33.1
4040
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
41-
github.com/pkg/errors v0.9.1
4241
github.com/slok/go-http-metrics v0.10.0
4342
github.com/spf13/cobra v1.8.1
4443
github.com/spf13/viper v1.16.0
@@ -103,6 +102,7 @@ require (
103102
github.com/olekukonko/tablewriter v0.0.5 // indirect
104103
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
105104
github.com/pjbgf/sha1cd v0.3.0 // indirect
105+
github.com/pkg/errors v0.9.1 // indirect
106106
github.com/rs/xid v1.2.1 // indirect
107107
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 // indirect
108108
github.com/shabbyrobe/gocovmerge v0.0.0-20180507124511-f6ea450bfb63 // indirect

pkg/kube/kubehttp.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
package kube
22

33
import (
4+
"errors"
45
"fmt"
56
"os"
67
"strings"
78

8-
"k8s.io/client-go/rest"
9-
"k8s.io/client-go/tools/clientcmd"
10-
"sigs.k8s.io/controller-runtime/pkg/client"
11-
129
helmv2 "github.com/fluxcd/helm-controller/api/v2"
1310
imgautomationv1 "github.com/fluxcd/image-automation-controller/api/v1beta2"
1411
reflectorv1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
@@ -17,7 +14,6 @@ import (
1714
notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2"
1815
sourcev1 "github.com/fluxcd/source-controller/api/v1"
1916
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
20-
"github.com/pkg/errors"
2117
pacv2beta2 "github.com/weaveworks/policy-agent/api/v2beta2"
2218
appsv1 "k8s.io/api/apps/v1"
2319
authv1 "k8s.io/api/authentication/v1"
@@ -26,6 +22,9 @@ import (
2622
extensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2723
apiruntime "k8s.io/apimachinery/pkg/runtime"
2824
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
25+
"k8s.io/client-go/rest"
26+
"k8s.io/client-go/tools/clientcmd"
27+
"sigs.k8s.io/controller-runtime/pkg/client"
2928
)
3029

3130
func CreateScheme() (*apiruntime.Scheme, error) {
@@ -65,7 +64,7 @@ const (
6564

6665
var (
6766
// ErrWegoConfigNotFound indicates weave gitops config could not be found
68-
ErrWegoConfigNotFound = errors.New("Wego Config not found")
67+
ErrWegoConfigNotFound = errors.New("wego config not found")
6968
)
7069

7170
// InClusterConfig defines a function for checking if this code is executing in kubernetes.

pkg/services/auth/jwt.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package auth
22

33
import (
4+
"errors"
5+
"fmt"
46
"time"
57

6-
"github.com/pkg/errors"
7-
88
"github.com/weaveworks/weave-gitops/pkg/gitproviders"
99

1010
"github.com/golang-jwt/jwt/v4"
@@ -80,7 +80,7 @@ func (i *internalJWTClient) VerifyJWT(accessToken string) (*Claims, error) {
8080
)
8181

8282
if err != nil {
83-
return nil, errors.WithMessage(ErrUnauthorizedToken, err.Error())
83+
return nil, fmt.Errorf("%w: %w", ErrUnauthorizedToken, err)
8484
}
8585

8686
claims, ok := token.Claims.(*Claims)

0 commit comments

Comments
 (0)