aboutsummaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)Author
12 hours[DO-NOT-MERGE] all: add option shutdown-idleHEADmainShulhan
The shutdown-idle set the duration to automatically shutdown the HTTP server when no request after specific duration. This is to complement the socket based activation to minimize the resources on local environment.
12 hours[DO-NOT-MERGE] cmd/pkgsite: implement socket based activationShulhan
5 daysgo.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: I0e4e9a00bda8777e7930d2b09e40dba681bfb768 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/764907 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Gopher Robot <gobot@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 daysinternal/queue: add postgres queue implementation, and use it in worker|frontendJean Barkhuysen
Fixes golang/go#74027. Change-Id: I916ac81093e782d4eda21fe11ef47eeff4f5f0b1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/751480 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
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>
2026-03-24all: pgx/v4 to v5 and upgrade pqEthan Lee
- In preparation for upgrade to PostgreSQL 17, upgrade stale dependencies within pkgsite. Change-Id: Id54cbb46182711b9808ee3bbbe2f0d5d9a04583d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/758121 Auto-Submit: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2026-03-12go.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: I2421b8fadf19befc309b16096bb771cd7ba808fc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754683 kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Gopher Robot <gobot@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2026-02-25internal/queue: move InMemory queue to its own packageJean Barkhuysen
Currently, InMemory queue sits in queue, and is instantiated in gcpqueue for convenience. In preparation for a third queue type (Postgres), this CL separates the two more cleanly, making it more ergonomic for the new queue type to slot in next to the existing two. This CL doesn't change any logic: it just exists to make the next CL smaller and easier to review. I also took the liberty of adding some tests specific to the InMemory queue, since I didn't find any. Let me know if it's tested in another place, though, and if you'd prefer me to remove it. Updates golang/go#74027. Change-Id: I44bd92129f33bc7975fcd138c905e0b7ab49d257 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/747881 kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ethan Lee <ethanalee@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2026-02-24internal/worker: add an option for in-process periodic poll/enqueue-ingJean Barkhuysen
Fixes golang/go#77689. Change-Id: Id754eeafdc8b680acb1aa137225292c808d0bf04 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/747880 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: David Chase <drchase@google.com>
2026-02-23internal/database: set db connection pool limitsHana Kim
Under high-load, the frontend can issue many queries and trigger many connections. This can exceed the Cloud SQL connection limit of 100 per instance enforced by the Cloud Run environment, even if the database itself has remaining global capacity. To prevent this, we introduce limits on the database connection pool. We also include settings for idle connections and connection lifetimes to ensure better resource management and connection rotation. Introduces new env vars: GO_DISCOVERY_DATABASE_MAX_OPEN_CONNS GO_DISCOVERY_DATABASE_MAX_IDLE_CONNS GO_DISCOVERY_DATABASE_CONN_MAX_LIFETIME GO_DISCOVERY_DATABASE_CONN_MAX_IDLE_TIME Updates SetPoolSettings to validate that MaxIdleConns does not exceed MaxOpenConns, providing a warning if it does and capping it. Change-Id: I74edac05c4a23102d64e74a180c661c223e1b757 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/747620 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2026-02-23frontend: fix loading stdlib in direct_proxy modeEthan Lee
- internal/fetch: fix stdlib path extraction by removing invalid "std/" prefix. - internal/fetchdatasource: fix "std" proxy errors in GetLatestInfo. - cmd/frontend: prioritize stdlib getter and add local GOROOT optimization. Reproduction: - `go run ./cmd/frontend -dev -direct_proxy` should utilize the local GOROOT as the source for stdlib. - `go run ./cmd/frontend -direct_proxy` should enable one to via a stdlib library at `localhost:8080/std` or any other stdlib pkg. Fixes golang/go#77112 Change-Id: I0686922804178129550d9bb9edc87b2adff51aa6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/746700 Auto-Submit: Ethan Lee <ethanalee@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-02-09go.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: Ib5e6476d1539dc52fa50f2842d0066e3bcf243cd Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/743408 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Gopher Robot <gobot@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-01-12go.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: I5801b1fd083b0a88c8848bd9e49723fe34cae7ba Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/735765 Auto-Submit: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-12-23cmd/internal/doc: increase x/pkgsite dependency to CL 729900matloob
So that go/doc could show docs for the new experiments. I updated the go command to use the latest commit of the doc module but id didn't yet have a dependency on a version of pkgsite that included Sean's changes. This CL adds that dependency, and then we'll have to re-update 'go doc' to depend on a version of this module that includes this CL. Commands run from cmd/internal/doc: go get golang.org/x/pkgsite@4eb0af2 go mod tidy For golang/go#71488 Change-Id: I228ba4477876a26bca8c91b44c254ce16a6a6964 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/732240 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Michael Matloob <matloob@golang.org> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Bypass: Michael Matloob <matloob@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@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-12-20internal/frontend: add CodeWiki link support to pkgsiteEthan Lee
- If a module's source repo exists in CodeWiki, display a link to codewiki.google/repo. - Disable the CodeWiki link from being displayed for screentests by adding it to the hidden elements. Change-Id: Ia5feb913280b8066806e56524bf9d32ce51f0614 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/730880 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> Auto-Submit: Ethan Lee <ethanalee@google.com>
2025-12-09go.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: I90bbb062ee42f45f23b2a4d97447d7bbb066b324 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/728523 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Gopher Robot <gobot@golang.org>
2025-11-13go.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: I9da6bcee42ffb7f1ebdffcfca8b0c6673f3551dc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/720163 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Gopher Robot <gobot@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: David Chase <drchase@google.com>
2025-10-28all: remove code for the decommissioned beta environmentNicholas S. Husin
The beta environment is no longer in use. This change removes related logic and references, such as the middleware redirect to beta.pkg.go.dev. Change-Id: I0c6ebbe11d5689ccf2abf8c722399d8dc339db89 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/715321 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-09go.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: I54ac128d9a58c1b2aaa15e17c0e4415c357d8d6a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/710110 Auto-Submit: Gopher Robot <gobot@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2025-09-11go.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: Icf4a7bbd4511c2eb8c7ce94ea7c5aa9c4b09cdcf Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/702045 Auto-Submit: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2025-09-08cmd/internal/cmdconfig: include Cloud Run instance ID in logsMichael Pratt
This aids in diagnosing per-instance issues. The instance ID seems like it would belong in the MonitoredResource labels (configured in serverconfig), but the top-level instanceId field is the standard name for this field on Cloud Run. Log messages going directly to stderr (before we configure logging) get this label automatically from the Cloud Run infra. When we use stackdriver directly we apparently need to add this ourselves. See https://cloud.google.com/run/docs/logging#service-fields. Change-Id: I6a6a636cb11a2abc00347e0679605ebbdb9995f4 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/700396 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>
2025-08-08go.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: I0e93b41c2ab47eb6c42f2f91398beaa1c455461c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/694005 Auto-Submit: Gopher Robot <gobot@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-07-14cmd/internal/pkgsite: increase x/pkgsite dependency to CL 687918Michael Matloob
This CL increases the dependency on the golang.org/x/pkgsite module to include the changes in CL 687918. For golang/go#74459 Change-Id: I8e72c9e841b081ad9818d86a4fd8aa8ee499ad52 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/687976 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-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-07-11go.mod: update golang.org/x dependenciesGopher Robot
Update golang.org/x dependencies to their latest tagged versions. Change-Id: I7976645ea13a7d7e8f322d311290d85b1ba9bc5d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/687560 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Gopher Robot <gobot@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
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-30cmd/internal/doc: enable go doc modeMichael Matloob
This turns off unnecessary UI and doesn't try to get deps.dev urls or vulnerability info. Change-Id: I2c7567a5d3e93e6a9b1a8b84f863f0dfe9a79d04 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/675958 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Michael Matloob <matloob@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.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/doc: set go.mod go version to 1.24.3Michael Matloob
The proxy and sumdb don't know how to fetch 1.25 modules (and we break a bunch of other things) so downgrade to the latest released go version so that the module can be fetched. For golang/go#68106 Change-Id: I611614ca814c8f8640bf886029cc702b3acc8cf0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/674575 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2025-05-20cmd/internal/doc: add doc command in its own moduleMichael Matloob
This change adds a simpler version of cmd/pkgsite, called simply 'doc', that will be invoked by the go command to show package documentation in the browser. This version has a couple of small changes. The first is that it uses the AllowNoModules option added to the server to allow no modules to match. It also makes the logging more quiet so that it's more in line with expectations for a go tool. Finally, it takes the path of the page to open in the browser to open after we start listening on the given address. The unused functionality of cmd/pkgsite is stripped out of the doc command. The doc command is placed into its own module, in the cmd/internal directory so we can see the set of module dependencies in the go.mod file is limited to the smaller set of modules that cmd/pkgsite's dependencies were limited to. For golang/go#68106 Change-Id: Iab9db7c02044a5e08c1f6bc6894b24a400382aae Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/674437 Reviewed-by: Michael Matloob <matloob@google.com> kokoro-CI: kokoro <noreply+kokoro@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-04-14cmd/pkgsite: indent command so it appears as preformatted textAdam Bender
This matches the other commands in the file. go/doc does not support backticks. Change-Id: Ief7366feaf9c1bc31bbc793d04e61681a21482db Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/664735 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Sean Liao <sean@liao.dev> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.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-09-05all: fix printf(var) mistake detected by latest printf checkerTim King
For golang/go#69267. Change-Id: I050c167e2e3ce36541e0d71469fb3f5778f5a882 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/610517 Reviewed-by: Ian Lance Taylor <iant@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.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-03-01internal/middleware,etc.: store requestsJonathan Amsterdam
This CL provides several improvements to the worker home page: - Display all requests, not just fetches. - Link to the logs for each request. - Link that will cancel a request. At the heart of these changes is a new piece of middleware that tracks all active requests, along with their trace ID and a function that can be used to cancel them. This change also affects logging, because the logger doesn't need to maintain its own trace ID. Change-Id: Id022170073d2d7ca4e45aaa1d78b216d8a512f35 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/568236 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com>
2024-02-27internal/worker: improve home and debug pagesJonathan Amsterdam
- Move excluded prefix list to a separate page. - Move debug pages under "/debug". (Previously the dcensus ones weren't even exposed.) - Add links to debug pages at top of home page. Change-Id: If26e139984b34cb6b2ef78af8ef154d96436a26a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/566418 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@golang.org>
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>
2024-01-08cmd/pkgsite: fix case where we don't have runtime.GOROOT()Michael Matloob
If pkgsite is built with -trimpath, runtime.GOROOT() returns an empty string, so we don't know where the local go stdlib is. In that case, don't try to serve a local stdlib and instead fall back to the stdlibZipModuleGetter. Also fix two issues that show up when using the stdlibZipModuleGetter. First, we try to prefetch fetch.LocalVersion of the standard library when the server starts. Instead, prefetch latest which will have the correct behavior with both the stdlib zips and local stdlib. Second, when we're trying to fetch the stdlib using git make sure that we're on another branch than the one we're trying to fetch into because git won't let us fetch into the branch we're on. Fixes golang/go#64903 Change-Id: I9dfb22d50b7738080490ce2682e0cf187c16d2d1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/554195 TryBot-Bypass: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-12-21cmd/pkgsite,internal/fetch: improve startup experienceMichael Matloob
When a user tries to look at the documentation for a unit for the first time, we process all the packages in the module. Kick off goroutines to do that so that the modules' packages might be processed by the time the user sees them. Also parallelize processing the packages in the module. That brings processing std from about 8 seconds to about 3 seconds. Change-Id: I505979d682897d2d1e55ce9e123e3ff4d1fb0e70 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/551776 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>
2023-08-31all: skip tests that can't run on wasm platformsMichael Matloob
Some because the network support isn't enough for httpreplay, and some because we need the Go command. For golang/go#61209 Change-Id: I02c6b7d10553d931c746723ce9608f39834c131c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/524797 Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-30internal/trace: add a wrapper for tracingMichael Matloob
This package adds a StartSpan function that does nothing unless an implementation for the StartSpan function is injected in. That allows us to have the frontend and worker mains inject the implementation while internal/fetch and internal/source can use the StartSpan function without depending on opencensus's tracing library. For golang/go#61399 Change-Id: I2c650bdbb56c8fcc47ffabab8353cef74e0d1c4e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523739 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> kokoro-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-29internal/frontend: inject *http.Client for deps.dev requestsMichael Matloob
This removes the dependency from internal/frontend onto ochttp. For golang/go#61399 Change-Id: Iac017964801b5ec4df823167dc5b9be6d80c786c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523514 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: 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> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-29internal/proxy: inject transport in proxy.NewMichael Matloob
This removes the dependency from internal/proxy on ochttp. For golang/go#61399 Change-Id: Ib2a350151752dc18c9a6e03b38b2d423ed55f4a1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523513 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> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
2023-08-29internal/frontend: remove depsdev/result_count metricMichael Matloob
go-discovery/depsdev/result_count doesn't seem to be used anywhere so remove it. For golang/go#61399 Change-Id: I253401d03bb1bfba4c569e45abfbf1d59a2a9b44 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523512 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2023-08-29internal/frontend: remove frontend_version_type/result_count metricMichael Matloob
go-discovery/frontend_version_type/result_count doesn't seem to be used anywhere so remove it. For golang/go#61399 Change-Id: I496cb5b68ab7deb250f553cd5cfc6e6abc8ef990 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523511 kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Michael Matloob <matloob@golang.org>
2023-08-29internal/source: inject *http.Client into source.NewClientMichael Matloob
This removes the dependency from package source onto ochttp. The users of source.NewClient that want an ochttp.Transport can set the transport on the *http.Client. For golang/go#61399 Change-Id: Ifb7126c482f664ee5a359f594d9324f0fd90f8b2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523510 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com>