diff options
| author | Julie Qiu <julie@golang.org> | 2019-09-17 15:16:28 -0400 |
|---|---|---|
| committer | Julie Qiu <julie@golang.org> | 2020-03-27 16:46:43 -0400 |
| commit | 676fa2caed96f6ee34b628d1644640e64ea8886d (patch) | |
| tree | 6de67f80b45d2fec9d86e44ca70ada46da39700e /internal/stdlib | |
| parent | af87653f075b2d853a77a4e9ad2b117c6087e571 (diff) | |
| download | go-x-pkgsite-676fa2caed96f6ee34b628d1644640e64ea8886d.tar.xz | |
content,internal/frontend: add README and license source filepaths
For modules hosted on github.com, bitbucket.org and golang.org, the URL
path is displayed. For other modules the zip filepath is displayed.
Fixes b/140933339
Fixes b/137207297
Change-Id: I536051c638d6fe05696d91aae0a40f065d563918
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/553297
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/stdlib')
| -rw-r--r-- | internal/stdlib/stdlib.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/stdlib/stdlib.go b/internal/stdlib/stdlib.go index 242ebba7..d386d0f2 100644 --- a/internal/stdlib/stdlib.go +++ b/internal/stdlib/stdlib.go @@ -40,7 +40,9 @@ const ModulePath = "std" // TagForVersion returns the Go standard library repository tag corresponding // to semver. The Go tags differ from standard semantic versions in a few ways, // such as beginning with "go" instead of "v". -func TagForVersion(version string) (string, error) { +func TagForVersion(version string) (_ string, err error) { + defer derrors.Wrap(&err, "TagForVersion(%q)", version) + if !semver.IsValid(version) { return "", derrors.FromHTTPStatus(http.StatusBadRequest, "requested version is not a valid semantic version: %q ", version) } @@ -86,7 +88,7 @@ func finalDigitsIndex(s string) int { return i + 1 } -const goRepoURL = "https://go.googlesource.com/go" +const GoRepoURL = "https://go.googlesource.com/go" // UseTestData determines whether to really clone the Go repo, or use // stripped-down versions of the repo from the testdata directory. @@ -102,7 +104,7 @@ func getGoRepo(version string) (_ *git.Repository, err error) { return nil, err } return git.Clone(memory.NewStorage(), nil, &git.CloneOptions{ - URL: goRepoURL, + URL: GoRepoURL, ReferenceName: plumbing.NewTagReferenceName(tag), SingleBranch: true, Depth: 1, @@ -148,7 +150,7 @@ func Versions() (_ []string, err error) { refNames = testRefs } else { re := git.NewRemote(memory.NewStorage(), &config.RemoteConfig{ - URLs: []string{goRepoURL}, + URLs: []string{GoRepoURL}, }) refs, err := re.List(&git.ListOptions{}) if err != nil { |
