Merge pull request #844 from gy95/errors

replace github.com/pkg/errors with Go native error
This commit is contained in:
karmada-bot 2021-10-21 11:42:09 +08:00 committed by GitHub
commit 9c891f56cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

2
go.mod
View File

@ -10,8 +10,8 @@ require (
github.com/kr/pretty v0.3.0 github.com/kr/pretty v0.3.0
github.com/onsi/ginkgo v1.16.4 github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.14.0 github.com/onsi/gomega v1.14.0
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_golang v1.11.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.1.3 github.com/spf13/cobra v1.1.3
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
golang.org/x/tools v0.1.2 golang.org/x/tools v0.1.2

View File

@ -9,7 +9,6 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/api/meta"
@ -213,7 +212,7 @@ func (g *CommandGetOptions) Run(karmadaConfig KarmadaConfig, cmd *cobra.Command,
} }
if err := g.getSecretTokenInKarmada(karmadaclient, g.Clusters[idx], clusterInfos); err != nil { if err := g.getSecretTokenInKarmada(karmadaclient, g.Clusters[idx], clusterInfos); err != nil {
return errors.Wrap(err, "Method getSecretTokenInKarmada get Secret info in karmada failed, err is") return fmt.Errorf("Method getSecretTokenInKarmada get Secret info in karmada failed, err is: %w", err)
} }
f := getFactory(g.Clusters[idx], clusterInfos) f := getFactory(g.Clusters[idx], clusterInfos)
go g.getObjInfo(&wg, &mux, f, g.Clusters[idx], &objs, &allErrs, args) go g.getObjInfo(&wg, &mux, f, g.Clusters[idx], &objs, &allErrs, args)
@ -396,11 +395,11 @@ type ClusterInfo struct {
func clusterInfoInit(g *CommandGetOptions, karmadaConfig KarmadaConfig, clusterInfos map[string]*ClusterInfo) (*rest.Config, error) { func clusterInfoInit(g *CommandGetOptions, karmadaConfig KarmadaConfig, clusterInfos map[string]*ClusterInfo) (*rest.Config, error) {
karmadaclient, err := karmadaConfig.GetRestConfig(g.KarmadaContext, g.KubeConfig) karmadaclient, err := karmadaConfig.GetRestConfig(g.KarmadaContext, g.KubeConfig)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "Func GetRestConfig get karmada client failed, err is") return nil, fmt.Errorf("Func GetRestConfig get karmada client failed, err is: %w", err)
} }
if err := getClusterInKarmada(karmadaclient, clusterInfos); err != nil { if err := getClusterInKarmada(karmadaclient, clusterInfos); err != nil {
return nil, errors.Wrap(err, "Method getClusterInKarmada get cluster info in karmada failed, err is") return nil, fmt.Errorf("Method getClusterInKarmada get cluster info in karmada failed, err is: %w", err)
} }
if err := getRBInKarmada(g.Namespace, karmadaclient); err != nil { if err := getRBInKarmada(g.Namespace, karmadaclient); err != nil {