From fcb63f60fccb2b2e627462283ac9a652e2ffa0ad Mon Sep 17 00:00:00 2001 From: James Sheppard Date: Sun, 7 May 2023 17:49:59 +0000 Subject: [PATCH] clean up error imports for repo pkg Signed-off-by: James Sheppard --- pkg/repo/chartrepo.go | 10 +++++----- pkg/repo/index.go | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index d9022ee6e..60633b7d6 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -63,12 +63,12 @@ type ChartRepository struct { func NewChartRepository(cfg *Entry, getters getter.Providers) (*ChartRepository, error) { u, err := url.Parse(cfg.URL) if err != nil { - return nil, errors.Errorf("invalid chart URL format: %s", cfg.URL) + return nil, fmt.Errorf("invalid chart URL format: %s", cfg.URL) } client, err := getters.ByScheme(u.Scheme) if err != nil { - return nil, errors.Errorf("could not find protocol handler for: %s", u.Scheme) + return nil, fmt.Errorf("could not find protocol handler for: %s", u.Scheme) } return &ChartRepository{ @@ -90,7 +90,7 @@ func (r *ChartRepository) Load() error { return err } if !dirInfo.IsDir() { - return errors.Errorf("%q is not a directory", r.Config.Name) + return fmt.Errorf("%q is not a directory", r.Config.Name) } // FIXME: Why are we recursively walking directories? @@ -265,11 +265,11 @@ func FindChartInAuthAndTLSAndPassRepoURL(repoURL, username, password, chartName, } cv, err := repoIndex.Get(chartName, chartVersion) if err != nil { - return "", errors.Errorf("%s not found in %s repository", errMsg, repoURL) + return "", fmt.Errorf("%s not found in %s repository", errMsg, repoURL) } if len(cv.URLs) == 0 { - return "", errors.Errorf("%s has no downloadable URLs", errMsg) + return "", fmt.Errorf("%s has no downloadable URLs", errMsg) } chartURL := cv.URLs[0] diff --git a/pkg/repo/index.go b/pkg/repo/index.go index ba2e365c8..b04f749fa 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -18,6 +18,7 @@ package repo import ( "bytes" + "fmt" "log" "os" "path" @@ -218,7 +219,7 @@ func (i IndexFile) Get(name, version string) (*ChartVersion, error) { return ver, nil } } - return nil, errors.Errorf("no chart version found for %s-%s", name, version) + return nil, fmt.Errorf("no chart version found for %s-%s", name, version) } // WriteFile writes an index file to the given destination path.