diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index a3c8f0525..e4c67d117 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -94,8 +94,8 @@ func (r *File) Get(name string) *Entry { return nil } -// Get returns an entry with the given URL if it exists, otherwise returns nil -func (r *File) GetURL(url string) *Entry { +// GetRepoFromURL returns an entry with the given URL if it exists, otherwise returns nil +func (r *File) GetRepoFromURL(url string) *Entry { for _, entry := range r.Repositories { if entry.URL == url { return entry @@ -109,7 +109,7 @@ func FindRepoEntry(url string, repositoryConfig string) (*Entry, error) { if err != nil { return nil, err } - entry := f.GetURL(url) + entry := f.GetRepoFromURL(url) if entry == nil { return nil, nil } diff --git a/pkg/repo/repo_test.go b/pkg/repo/repo_test.go index 5c39952df..52ce15afe 100644 --- a/pkg/repo/repo_test.go +++ b/pkg/repo/repo_test.go @@ -128,7 +128,7 @@ func TestRepoFile_Get(t *testing.T) { } } -func TestRepoFile_GetURL(t *testing.T) { +func TestGetRepoFromURL(t *testing.T) { repo := NewFile() repo.Add( &Entry{ @@ -151,7 +151,7 @@ func TestRepoFile_GetURL(t *testing.T) { url := "https://example.com/second" - entry := repo.GetURL(url) + entry := repo.GetRepoFromURL(url) if entry == nil { t.Fatalf("Expected repo entry %q to be found", url) } @@ -160,7 +160,7 @@ func TestRepoFile_GetURL(t *testing.T) { t.Errorf("Expected repo Name to be %q but got %q", "second", entry.Name) } - entry = repo.GetURL("http://nonexistent.example.com/nonexistent") + entry = repo.GetRepoFromURL("http://nonexistent.example.com/nonexistent") if entry != nil { t.Errorf("Got unexpected entry %+v", entry) }