replace as many github error deps as possible from cmd/helm

Signed-off-by: James Sheppard <jgsheppa@protonmail.com>
pull/12063/head
James Sheppard 2 years ago
parent be97863cf8
commit 5a1c5f737c

@ -294,7 +294,7 @@ func checkIfInstallable(ch *chart.Chart) error {
case "", "application": case "", "application":
return nil return nil
} }
return errors.Errorf("%s charts are not installable", ch.Metadata.Type) return fmt.Errorf("%s charts are not installable", ch.Metadata.Type)
} }
// Provide dynamic auto-completion for the install and template commands // Provide dynamic auto-completion for the install and template commands

@ -17,12 +17,13 @@ limitations under the License.
package main package main
import ( import (
"errors"
"fmt" "fmt"
"io" "io"
"os" "os"
"path/filepath" "path/filepath"
"github.com/pkg/errors" githubErrors "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/cmd/helm/require"
@ -65,7 +66,7 @@ func (o *repoRemoveOptions) run(out io.Writer) error {
for _, name := range o.names { for _, name := range o.names {
if !r.Remove(name) { if !r.Remove(name) {
return errors.Errorf("no repo named %q found", name) return fmt.Errorf("no repo named %q found", name)
} }
if err := r.WriteFile(o.repoFile, 0644); err != nil { if err := r.WriteFile(o.repoFile, 0644); err != nil {
return err return err
@ -90,7 +91,7 @@ func removeRepoCache(root, name string) error {
if _, err := os.Stat(idx); os.IsNotExist(err) { if _, err := os.Stat(idx); os.IsNotExist(err) {
return nil return nil
} else if err != nil { } else if err != nil {
return errors.Wrapf(err, "can't remove index file %s", idx) return githubErrors.Wrapf(err, "can't remove index file %s", idx)
} }
return os.Remove(idx) return os.Remove(idx)
} }

@ -17,11 +17,12 @@ limitations under the License.
package main package main
import ( import (
"errors"
"fmt" "fmt"
"io" "io"
"sync" "sync"
"github.com/pkg/errors" githubErrors "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/cmd/helm/require"
@ -83,7 +84,7 @@ func (o *repoUpdateOptions) run(out io.Writer) error {
case isNotExist(err): case isNotExist(err):
return errNoRepositories return errNoRepositories
case err != nil: case err != nil:
return errors.Wrapf(err, "failed loading file: %s", o.repoFile) return githubErrors.Wrapf(err, "failed loading file: %s", o.repoFile)
case len(f.Repositories) == 0: case len(f.Repositories) == 0:
return errNoRepositories return errNoRepositories
} }
@ -133,7 +134,7 @@ func updateCharts(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdate
wg.Wait() wg.Wait()
if len(repoFailList) > 0 && failOnRepoUpdateFail { if len(repoFailList) > 0 && failOnRepoUpdateFail {
return fmt.Errorf("Failed to update the following repositories: %s", return fmt.Errorf("failed to update the following repositories: %s",
repoFailList) repoFailList)
} }
@ -151,7 +152,7 @@ func checkRequestedRepos(requestedRepos []string, validRepos []*repo.Entry) erro
} }
} }
if !found { if !found {
return errors.Errorf("no repositories found matching '%s'. Nothing will be updated", requestedRepo) return fmt.Errorf("no repositories found matching '%s'. Nothing will be updated", requestedRepo)
} }
} }
return nil return nil

@ -19,6 +19,7 @@ package main
import ( import (
"bufio" "bufio"
"bytes" "bytes"
"errors"
"fmt" "fmt"
"io" "io"
"os" "os"
@ -27,7 +28,7 @@ import (
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/gosuri/uitable" "github.com/gosuri/uitable"
"github.com/pkg/errors" githubErrors "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/search" "helm.sh/helm/v3/cmd/helm/search"
@ -149,7 +150,7 @@ func (o *searchRepoOptions) applyConstraint(res []*search.Result) ([]*search.Res
constraint, err := semver.NewConstraint(o.version) constraint, err := semver.NewConstraint(o.version)
if err != nil { if err != nil {
return res, errors.Wrap(err, "an invalid version/constraint format") return res, githubErrors.Wrap(err, "an invalid version/constraint format")
} }
data := res[:0] data := res[:0]

Loading…
Cancel
Save