Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
improve doc for SourceURLsForPath()
Browse files Browse the repository at this point in the history
and an error msg in `maybeSources.try()`
  • Loading branch information
michael-go committed Sep 19, 2017
1 parent cacb8ff commit 348b869
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/gps/maybe_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (mbs maybeSources) try(ctx context.Context, cachedir string, c singleSource
for _, url := range mb.possibleURLs() {
urls += url.String() + "\n"
}
errs = append(errs, errors.Wrapf(err, "failed to set up %q", urls))
errs = append(errs, errors.Wrapf(err, "failed to set up sources from the following URLs:\n%s", urls))
}

return nil, 0, errors.Wrap(&errs, "no valid source could be created")
Expand Down
9 changes: 6 additions & 3 deletions internal/gps/source_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ type SourceManager interface {
// project/source root.
DeduceProjectRoot(ip string) (ProjectRoot, error)

// SourceURLsForPath takes an import path and deduces the possible source URLs
// SourceURLsForPath takes an import path and deduces the set of source URLs
// that may refer to a canonical upstream source.
// In general, these URLs differ only by protocol (e.g. https vs. ssh), not path
SourceURLsForPath(ip string) ([]*url.URL, error)

// Release lets go of any locks held by the SourceManager. Once called, it is
Expand Down Expand Up @@ -540,8 +542,9 @@ func (sm *SourceMgr) InferConstraint(s string, pi ProjectIdentifier) (Constraint
return nil, errors.Errorf("%s is not a valid version for the package %s(%s)", s, pi.ProjectRoot, pi.Source)
}

// SourceURLsForPath takes an import path, deduces it's root path,
// and returns a list of possible souce URLs for fetching it
// SourceURLsForPath takes an import path and deduces the set of source URLs
// that may refer to a canonical upstream source.
// In general, these URLs differ only by protocol (e.g. https vs. ssh), not path
func (sm *SourceMgr) SourceURLsForPath(ip string) ([]*url.URL, error) {
deduced, err := sm.deduceCoord.deduceRootPath(context.TODO(), ip)
if err != nil {
Expand Down

0 comments on commit 348b869

Please sign in to comment.