Skip to content

Commit 4a15c63

Browse files
committed
internal/frontend: omit cmd packages from /std
Packages in cmd/ are now omitted from the directory listing on pkg.go.dev/std, as in the case of golang.org/pkg. For golang/go#44356 Change-Id: I160965d1b914a11863a815db3184d8b9823e8ae1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/296951 Trust: Julie Qiu <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]>
1 parent 7e5e233 commit 4a15c63

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/frontend/directory.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"strings"
1111

1212
"golang.org/x/pkgsite/internal"
13+
"golang.org/x/pkgsite/internal/stdlib"
1314
)
1415

1516
// UnitDirectory is the union of nested modules and subdirectories for a
@@ -116,6 +117,12 @@ func getSubdirectories(um *internal.UnitMeta, pkgs []*internal.PackageMeta) []*S
116117
if um.Path == pm.Path {
117118
continue
118119
}
120+
if um.Path == stdlib.ModulePath && strings.HasPrefix(pm.Path, "cmd/") {
121+
// Omit "cmd" from the directory listing on
122+
// pkg.go.dev/std, since go list std does not
123+
// list them.
124+
continue
125+
}
119126
sdirs = append(sdirs, &Subdirectory{
120127
URL: constructUnitURL(pm.Path, um.ModulePath, linkVersion(um.Version, um.ModulePath)),
121128
Suffix: internal.Suffix(pm.Path, um.Path),

0 commit comments

Comments
 (0)