commit | 103fd0f027b2b28bc0c34fd4ab630f8abd13a426 | [log] [tgz] |
---|---|---|
author | Michael Matloob <matloob@golang.org> | Mon Jul 14 14:17:02 2025 -0400 |
committer | Gopher Robot <gobot@golang.org> | Mon Jul 14 13:38:41 2025 -0700 |
tree | 280b8ce28d5e2b729d1f42b91ceeac46bfadba20 | |
parent | d4fd0614134092087d2d5b43811ff9e7daefa894 [diff] |
cmd/internal/pkgsite: improve godoc mode search in GOROOT If a user starts go doc -http inside of GOROOT, we create three module getters when we only need one: We create a StdlibZip module getter which we're not going to use because we're using a local GOROOT, we create a gopackages module getter for the module determined as corresponding to the current directory, which is a stdlib module, and finally we create the NewGoPackagesStdlibModuleGetter, which is the main module getter for the standard library in that case. The StdlibZip module getter is not used when we're using a local GOROOT, so don't add it in that case. And if we detect that the module for a specified directory is std or cmd for the specified local GOROOT, skip adding it because it will be redundant with the module getter we create using NewGoPackagesStdlibModuleGetter specifically for the standard libarry. Removing the redundant module getter will prevent redundant search results returned by each of the gopackages module getters corresponding to the standard library. While we're here, if there's a VERSION file in GOROOT, set the version on the module metadata we return for the standard library to the stdlib.VersionForTag of that version, so we can report the version in the search results. Fixes golang/go#74459 Change-Id: If250f715b052f57f8668b02a57b4c96725be515a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/687918 Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Auto-Submit: Michael Matloob <matloob@golang.org>
This repository hosts the source code of the pkg.go.dev website, and pkgsite
, a documentation server program.
Pkg.go.dev is a website for discovering and evaluating Go packages and modules.
You can check it out at https://pkg.go.dev.
pkgsite
program extracts and generates documentation for Go projects.
Example usage:
$ go install golang.org/x/pkgsite/cmd/pkgsite@latest $ cd myproject $ pkgsite -open .
For more information, see the pkgsite documentation.
If you want to report a bug or have a feature suggestion, please first check the known issues to see if your issue is already being discussed. If an issue does not already exist, feel free to file an issue.
For answers to frequently asked questions, see pkg.go.dev/about.
You can also chat with us on the #pkgsite Slack channel on the Gophers Slack.
We would love your help!
Our canonical Git repository is located at go.googlesource.com/pkgsite. There is a mirror of the repository at github.com/golang/pkgsite.
To contribute, please read our contributing guide.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.