aboutsummaryrefslogtreecommitdiff
path: root/cmd/internal/pkgsite/server.go
AgeCommit message (Collapse)Author
2026-03-30all.bash: re-enable unparamJonathan Amsterdam
It's working now. Also fix, issues that it detected. Change-Id: Ifd3fe5baf9a56d31bafe099bf4b38e02356bde21 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/760582 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Ethan Lee <ethanalee@google.com>
2026-03-26cmd/internal/pkgsite: fix godoc mode without -listFilippo Valsorda
Looks like it had always been broken, since m doesn't have a useful String() method. Change-Id: I6ad3a60916d3611fb38982a3aaf648c46a6a6964 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/737280 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2025-12-22internal/dcensus: add metrics for codewiki link usageEthan Lee
- Count link usage, target url and referrer page. - To avoid increasing dependency size, use indirection to call recordCodeWikiMetrics. Example: Run `go run ./cmd/frontend/main.go -dev -direct_proxy` and access pkgsite via localhost:8080. After clicking on the link, observe the relevant metric logged in localhost:8081/statz. Run `go test -v -run TestCmdPkgsiteDeps` to ensure that cmd/pkgsite dependencies remain stable. Change-Id: Ib312584162b81deac4c22b4ed923ff783133e11e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/731020 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-14cmd/internal/pkgsite: improve godoc mode search in GOROOTMichael Matloob
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>
2025-06-24Revert "internal/frontend: recycle database connections every 5m"Robert Findley
This reverts commit 4b544d88ef33b543889e92d50bcc7b02d4b95ff0. Reason for revert: From slack, this causes the following error: 2025/06/23 21:17:14 Error: middleware.Panic: sql: Register called twice for driver ocWrapper-pgx Change-Id: I7caf80f4e13ca341e2f29d20c4b5b9ed963695b2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/683635 Auto-Submit: Robert Findley <rfindley@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2025-06-23internal/frontend: recycle database connections every 5mRob Findley
In order to avoid imbalance between pkgsite's two database instances, recycle connections every 5 minutes. Change-Id: I9ca1e686a90f8c61619fd76454ec66163e501ee1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/680175 kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2025-05-30internal/frontend: add a go doc mode to suppress some UI elementsMichael Matloob
This change adds an option to the server to suppress the unit header details and the right hand side unit metadata that's shown on pkgsite, when it's operating in go doc mode. In this go doc mode, it will also not fetch the deps.dev url or vulnerability information, so that pkgsite doesn't make unnecessary network calls. The behavior to allow no modules to match the pattern has also been folded into go doc mode. I think we may also want to make some CSS changes too but I think those would belong in another CL. Change-Id: I8b6ebb5594f73684d2db41a84e1b6d46ee95d774 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/675957 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-20cmd/internal/pkgsite: add AllowNoModules option to ServerConfigMichael Matloob
If the user is outside of any modules, they should be able to still get documentation for the standard library. Allow no matching modules so we don't exit the command if no modules were found. For golang/go#68106 Change-Id: Ie9a06e1a3b055e3d13957019d06677f5aed46f4d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/674436 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Michael Matloob <matloob@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2025-03-11go.mod, misc: update to go 1.24Jonathan Amsterdam
Change-Id: Iba3d15376214048113314150944d3b0df187a8cf Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/656475 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
2024-07-24cmd/pkgsite: fix setting gorepo flagMichael Matloob
The value of the gorepo flag variable was being used before flags were parsed. Fix that. Also fix a couple of other issues that came up in golang/go#68533: First, don't print "searching GOPATH" when we're not searching GOPATH. Second, print the stderr from the go command in the error when it fails because it's the stderr that usually provides information about the failure, not the stdout. For golang/go#68533 Change-Id: Ic6321d6e071dd82415474f2a2c54146e9eabbef7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/600917 Reviewed-by: Jonathan Amsterdam <jba@google.com> Auto-Submit: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2024-02-07cmd: split the cmd/pkgsite server building logic to a new packageMichael Matloob
This will allow us to create a separate binary (probably called cmd/pkgdoc) that will be started by "go doc" to serve pkgsite. The separate binary can have different flags and options. Change-Id: Ie8c2cdce4c850c9f787db12679c872f279c435ad Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/561340 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>