From 8e4a8517c5b3d7c2af7c1b418c5e353c21379017 Mon Sep 17 00:00:00 2001 From: James Hewitt Date: Fri, 18 Aug 2023 13:51:54 +0100 Subject: [PATCH] Revert "fix: resolve most comments" This reverts commit 6a5846b32eb9f9b750c492d4eca1112bdb6855a9. Signed-off-by: James Hewitt --- registry/storage/catalog.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/registry/storage/catalog.go b/registry/storage/catalog.go index 019d159ed..09a687d8c 100644 --- a/registry/storage/catalog.go +++ b/registry/storage/catalog.go @@ -14,21 +14,20 @@ import ( ) var ( - // ErrStopReposWalk is a sentinel error to indicate that the repository path walk was stopped. + // ErrStopReposWalk is used as a return value to indicate that the repository path walk + // should be stopped. It's not returned as an error by any function. ErrStopReposWalk = errors.New("stop repos walk") ) -// Repositories populates the passed passed repos slice with repositories in the -// registry up to the capacity of the slice. Returns the number of repos returned and -// `io.EOF` if no more repositories are available. +// Returns a list or a partial list of repositories in the registry. // Because it's a quite expensive operation, it should only be used when building up // an initial set of repositories. func (reg *registry) Repositories(ctx context.Context, repos []string, last string) (n int, err error) { var finishedWalk bool var foundRepos []string - if len(repos) == 0 && cap(repos) == 0 { - return 0, errors.New("no repos requested") + if len(repos) == 0 { + return -1, errors.New("no repos requested") } root, err := pathFor(repositoriesRootPathSpec{})