diff --git a/cmd/helm/downloader/manager.go b/cmd/helm/downloader/manager.go index daa65ef97..5c9118888 100644 --- a/cmd/helm/downloader/manager.go +++ b/cmd/helm/downloader/manager.go @@ -227,7 +227,7 @@ func (m *Manager) hasAllRepos(deps []*chartutil.Dependency) error { found = true } else { for _, repo := range repos { - if urlutil.URLAreEqual(repo.URL, strings.TrimSuffix(dd.Repository, "/")) { + if urlutil.Equal(repo.URL, strings.TrimSuffix(dd.Repository, "/")) { found = true } } @@ -259,7 +259,7 @@ func (m *Manager) getRepoNames(deps []*chartutil.Dependency) (map[string]string, found := false for _, repo := range repos { - if urlutil.URLAreEqual(repo.URL, dd.Repository) { + if urlutil.Equal(repo.URL, dd.Repository) { found = true reposMap[dd.Name] = repo.Name break @@ -325,7 +325,7 @@ func (m *Manager) parallelRepoUpdate(repos []*repo.ChartRepositoryConfig) error // If it finds a URL that is "relative", it will prepend the repoURL. func findChartURL(name, version, repoURL string, repos map[string]*repo.ChartRepository) (string, error) { for _, cr := range repos { - if urlutil.URLAreEqual(repoURL, cr.Config.URL) { + if urlutil.Equal(repoURL, cr.Config.URL) { entry, err := findEntryByName(name, cr) if err != nil { return "", err diff --git a/pkg/urlutil/urlutil.go b/pkg/urlutil/urlutil.go index f99294938..3a6570470 100644 --- a/pkg/urlutil/urlutil.go +++ b/pkg/urlutil/urlutil.go @@ -41,10 +41,8 @@ func URLJoin(baseURL string, paths ...string) (string, error) { return u.String(), nil } -// URLAreEqual normalizes two URLs and then compares for equality. -// -// TODO: This and the urlJoin functions should really be moved to a 'urlutil' package. -func URLAreEqual(a, b string) bool { +// Equal normalizes two URLs and then compares for equality. +func Equal(a, b string) bool { au, err := url.Parse(a) if err != nil { a = filepath.Clean(a) diff --git a/pkg/urlutil/urlutil_test.go b/pkg/urlutil/urlutil_test.go index d4aa1139d..5944df1ae 100644 --- a/pkg/urlutil/urlutil_test.go +++ b/pkg/urlutil/urlutil_test.go @@ -39,7 +39,7 @@ func TestUrlJoin(t *testing.T) { } } -func TestUrlAreEqual(t *testing.T) { +func TestEqual(t *testing.T) { for _, tt := range []struct { a, b string match bool @@ -57,7 +57,7 @@ func TestUrlAreEqual(t *testing.T) { {"/foo", "/foo/", true}, {"/foo/.", "/foo/", true}, } { - if tt.match != URLAreEqual(tt.a, tt.b) { + if tt.match != Equal(tt.a, tt.b) { t.Errorf("Expected %q==%q to be %t", tt.a, tt.b, tt.match) } }