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

Commit 348b869

Browse files
committed
improve doc for SourceURLsForPath()
and an error msg in `maybeSources.try()`
1 parent cacb8ff commit 348b869

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

internal/gps/maybe_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (mbs maybeSources) try(ctx context.Context, cachedir string, c singleSource
5050
for _, url := range mb.possibleURLs() {
5151
urls += url.String() + "\n"
5252
}
53-
errs = append(errs, errors.Wrapf(err, "failed to set up %q", urls))
53+
errs = append(errs, errors.Wrapf(err, "failed to set up sources from the following URLs:\n%s", urls))
5454
}
5555

5656
return nil, 0, errors.Wrap(&errs, "no valid source could be created")

internal/gps/source_manager.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ type SourceManager interface {
7272
// project/source root.
7373
DeduceProjectRoot(ip string) (ProjectRoot, error)
7474

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

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

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

0 commit comments

Comments
 (0)