code: 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 {
  		return 0, errors.New("no space in slice")
  	}
  
  	root, err := pathFor(repositoriesRootPathSpec{})
  	if err != nil {
  		return 0, err
  	}
  
  	err = reg.blobStore.driver.Walk(ctx, root, func(fileInfo driver.FileInfo) error {
  		err := handleRepository(fileInfo, root, last, func(repoPath string) error {
  			foundRepos = append(foundRepos, repoPath)
  			return nil
  		})
  		if err != nil {
  			return err
  		}
  
  		// if we've filled our array, no need to walk any further
  		if len(foundRepos) == len(repos) {
  			finishedWalk = true
  			return driver.ErrSkipDir
  		}
  
  		return nil
  	})
  
  	n = copy(repos, foundRepos)
  
  	if err != nil {
  		return n, err
  	} else if !finishedWalk {
  		// We didn't fill buffer. No more records are available.
  		return n, io.EOF
  	}
  
  	return n, err
  }
docs: // 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
  // an initial set of repositories.