diff options
| author | Julie Qiu <julie@golang.org> | 2020-07-25 10:29:00 -0400 |
|---|---|---|
| committer | Julie Qiu <julie@golang.org> | 2020-07-27 22:12:25 +0000 |
| commit | 935176c963b5a3592c84f4e4a81fe805b6824d6c (patch) | |
| tree | e29ee6a3e98c9acc9165dd7d576811b3fb4eafab /internal/stdlib/stdlib.go | |
| parent | 0aa277875b034a3f9b9ca761e36791a56cde979f (diff) | |
| download | go-x-pkgsite-935176c963b5a3592c84f4e4a81fe805b6824d6c.tar.xz | |
internal/stdlib: fix stdlib README for new data model
The overview tab for the stdlib package is currently displaying
src/README.vendor, instead of README.md, when the use-directories
experiment flag is on. This is because based on the way the std
module zip is constructed, both README.md and README.vendor are present
at the root for version v1.4.0-beta.1 and higher. The
fetch process will then choose README.vendor to include, since
it comes after README.md alphabetically.
The README.vendor file is no longer included in the std zip.
For golang/go#39629
Change-Id: I1c9d8fcd1776f7b58be08f5f1ec1dc1b735e736d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/244608
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/stdlib/stdlib.go')
| -rw-r--r-- | internal/stdlib/stdlib.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/stdlib/stdlib.go b/internal/stdlib/stdlib.go index a44df651..d6c53c6a 100644 --- a/internal/stdlib/stdlib.go +++ b/internal/stdlib/stdlib.go @@ -340,6 +340,17 @@ func addFiles(z *zip.Writer, r *git.Repository, t *object.Tree, dirpath string, // ignore; we'll synthesize our own continue } + if e.Name == "README.vendor" && !strings.Contains(dirpath, "/") { + // For versions newer than v1.4.0-beta.1, the stdlib is in src/pkg. + // This means that our construction of the zip files will return + // two READMEs at the root: + // https://golang.org/README.md and + // https://golang.org/src/README.vendor + // We only want to display the README.md, so ignore README.vendor. + // However, we do want to store the README.vendor in + // std@<version>/cmd. + continue + } switch e.Mode { case filemode.Regular, filemode.Executable: blob, err := r.BlobObject(e.Hash) @@ -423,6 +434,7 @@ var testRefs = []plumbing.ReferenceName{ "refs/tags/go1.12.9", "refs/tags/go1.13", "refs/tags/go1.13beta1", + "refs/tags/go1.14.6", // other tags "refs/changes/56/93156/13", "refs/tags/release.r59", |
