Refactor errVal named parameter for catalog repositories to err
Signed-off-by: Edgar Lee <edgar.lee@docker.com>
This commit is contained in:
parent
734caef0f4
commit
22a59f2512
1 changed files with 8 additions and 8 deletions
|
@ -18,19 +18,19 @@ var ErrFinishedWalk = errors.New("finished walk")
|
||||||
// Returns a list, or partial list, of repositories in the registry.
|
// Returns a list, or partial list, of repositories in the registry.
|
||||||
// Because it's a quite expensive operation, it should only be used when building up
|
// Because it's a quite expensive operation, it should only be used when building up
|
||||||
// an initial set of repositories.
|
// an initial set of repositories.
|
||||||
func (reg *registry) Repositories(ctx context.Context, repos []string, last string) (n int, errVal error) {
|
func (reg *registry) Repositories(ctx context.Context, repos []string, last string) (n int, err error) {
|
||||||
var foundRepos []string
|
var foundRepos []string
|
||||||
|
|
||||||
if len(repos) == 0 {
|
if len(repos) == 0 {
|
||||||
return 0, errors.New("no space in slice")
|
return 0, errors.New("no space in slice")
|
||||||
}
|
}
|
||||||
|
|
||||||
root, errVal := pathFor(repositoriesRootPathSpec{})
|
root, err := pathFor(repositoriesRootPathSpec{})
|
||||||
if errVal != nil {
|
if err != nil {
|
||||||
return 0, errVal
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
errVal = Walk(ctx, reg.blobStore.driver, root, func(fileInfo driver.FileInfo) error {
|
err = Walk(ctx, reg.blobStore.driver, root, func(fileInfo driver.FileInfo) error {
|
||||||
filePath := fileInfo.Path()
|
filePath := fileInfo.Path()
|
||||||
|
|
||||||
// lop the base path off
|
// lop the base path off
|
||||||
|
@ -58,11 +58,11 @@ func (reg *registry) Repositories(ctx context.Context, repos []string, last stri
|
||||||
n = copy(repos, foundRepos)
|
n = copy(repos, foundRepos)
|
||||||
|
|
||||||
// Signal that we have no more entries by setting EOF
|
// Signal that we have no more entries by setting EOF
|
||||||
if len(foundRepos) <= len(repos) && (errVal == nil || errVal == ErrSkipDir) {
|
if len(foundRepos) <= len(repos) && (err == nil || err == ErrSkipDir) {
|
||||||
errVal = io.EOF
|
err = io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
return n, errVal
|
return n, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enumerate applies ingester to each repository
|
// Enumerate applies ingester to each repository
|
||||||
|
|
Loading…
Reference in a new issue