Remove github.com/pkg/errors with appropriate replacements (#3172)
* errors.Wrap* removal Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * remove errors.Errorf Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Remove remaining calls Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Few more errors Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Fix golint errors Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> --------- Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -19,7 +19,6 @@ package kubewatch
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -59,7 +58,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
|
||||
_, namespace, err := opts.GetResourceNamespace(input, flagkey.KwNamespace)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error in listing function ")
|
||||
return fmt.Errorf("error in listing function : %w", err)
|
||||
}
|
||||
|
||||
objType := input.String(flagkey.KwObjType)
|
||||
@@ -69,7 +68,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
specIgnore := util.GetSpecIgnore(input)
|
||||
fr, err := spec.ReadSpecs(specDir, specIgnore, false)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("error reading spec in '%v'", specDir))
|
||||
return fmt.Errorf("error reading spec in '%v': %w", specDir, err)
|
||||
}
|
||||
|
||||
exists, err := fr.ExistsInSpecs(fv1.Function{
|
||||
@@ -117,14 +116,14 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
|
||||
specFile := fmt.Sprintf("kubewatch-%v.yaml", opts.watcher.ObjectMeta.Name)
|
||||
err := spec.SpecSave(*opts.watcher, specFile, false)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error saving kubewatch spec")
|
||||
return fmt.Errorf("error saving kubewatch spec: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := opts.Client().FissionClientSet.CoreV1().KubernetesWatchTriggers(opts.watcher.ObjectMeta.Namespace).Create(input.Context(), opts.watcher, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error creating kubewatch")
|
||||
return fmt.Errorf("error creating kubewatch: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("trigger '%v' created\n", opts.watcher.ObjectMeta.Name)
|
||||
|
||||
@@ -19,7 +19,6 @@ package kubewatch
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
|
||||
@@ -50,7 +49,7 @@ func (opts *DeleteSubCommand) complete(input cli.Input) (err error) {
|
||||
opts.name = input.String(flagkey.KwName)
|
||||
_, opts.namespace, err = opts.GetResourceNamespace(input, flagkey.NamespaceTrigger)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error in deleting kubewatch")
|
||||
return fmt.Errorf("error in deleting kubewatch: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -61,7 +60,7 @@ func (opts *DeleteSubCommand) run(input cli.Input) error {
|
||||
if input.Bool(flagkey.IgnoreNotFound) && util.IsNotFound(err) {
|
||||
return nil
|
||||
}
|
||||
return errors.Wrap(err, "error deleting kubewatch")
|
||||
return fmt.Errorf("error deleting kubewatch: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("trigger '%v' deleted\n", opts.name)
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"os"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
v1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -50,7 +49,7 @@ func (opts *ListSubCommand) do(input cli.Input) error {
|
||||
func (opts *ListSubCommand) complete(input cli.Input) (err error) {
|
||||
_, opts.namespace, err = opts.GetResourceNamespace(input, flagkey.NamespaceTrigger)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error listing kubewatchers")
|
||||
return fmt.Errorf("error listing kubewatchers: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -63,7 +62,7 @@ func (opts *ListSubCommand) run(input cli.Input) (err error) {
|
||||
ws, err = opts.Client().FissionClientSet.CoreV1().KubernetesWatchTriggers(opts.namespace).List(input.Context(), metav1.ListOptions{})
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error listing kubewatchers")
|
||||
return fmt.Errorf("error listing kubewatchers: %w", err)
|
||||
}
|
||||
|
||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
|
||||
|
||||
Reference in New Issue
Block a user