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:
@@ -23,7 +23,8 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/cmd"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"errors"
|
||||
|
||||
"github.com/robfig/cron/v3"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -65,7 +66,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) (err error) {
|
||||
|
||||
userProvidedNS, fnNamespace, err := opts.GetResourceNamespace(input, flagkey.NamespaceFunction)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error in deleting function ")
|
||||
return fmt.Errorf("error in deleting function : %w", err)
|
||||
}
|
||||
|
||||
cronSpec := input.String(flagkey.TtCron)
|
||||
@@ -78,7 +79,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) (err 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{
|
||||
@@ -135,14 +136,14 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
|
||||
specFile := fmt.Sprintf("timetrigger-%v.yaml", opts.trigger.ObjectMeta.Name)
|
||||
err := spec.SpecSave(*opts.trigger, specFile, false)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error saving time trigger spec")
|
||||
return fmt.Errorf("error saving time trigger spec: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := opts.Client().FissionClientSet.CoreV1().TimeTriggers(opts.trigger.Namespace).Create(input.Context(), opts.trigger, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error creating Time trigger")
|
||||
return fmt.Errorf("error creating Time trigger: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("trigger '%v' created\n", opts.trigger.ObjectMeta.Name)
|
||||
@@ -151,7 +152,7 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
|
||||
|
||||
err = getCronNextNActivationTime(opts.trigger.Spec.Cron, t, 1)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error passing cron spec examination")
|
||||
return fmt.Errorf("error passing cron spec examination: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user