aboutsummaryrefslogtreecommitdiff
path: root/cmd/frontend
AgeCommit message (Collapse)Author
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-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-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>
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-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-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>
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>
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>
2023-08-25cmd/frontend: move typescript compile watching into mainMichael Matloob
To remove the dependency from cmd/pkgsite on to github.com/evanw/esbuild, this change moves the code that starts the watcher for recompiling typescript files into cmd/frontend. This means the dev mode functionality in cmd/pkgsite for watching and recompiling typescript files is gone. For golang/go#61399 Change-Id: If1325461de30dfd2f71b63d810cab8e9b4cdeb06 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/522735 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-08-25internal/config: separate config initialization into serverconfigMichael Matloob
This change creates a new package that does config initialization and other GCP-specific operations that were previously done in package config, so that config can have no cloud dependencies. For golang/go#61399 Change-Id: I8d78294834e325b47d838892a1cef87003a4b90a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/522516 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-08-22cmd/frontend: fix variable shadowing of redisClientRob Findley
Following CL 514518, the redisClient is always nil, due to a variable shadowing bug. This led to a production outage (golang/go#62210), which was not caught because the staging environment (where push tests run) was not configured to enforce quota. For starters, fix the variable shadowing bug. I looked into adding a failing test, but it seemed intractible without a major refactoring. Change-Id: I0492b2ece49759ebcae397c6600080fc44658f2b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/521835 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2023-08-21internal/frontend: move fetchserver and versions to their own packagesMichael Matloob
Moving fetchserver to its own package will allow us to to move the fetch logic, which isn't used by cmd/pkgsite because it doesn't have a postgres database, out of the frontend and pkgsite. The tests, which depend on a postgres database are moved out too, removing a few users of the postgres database in the tests. The versions code is moved into its own package as well so it can be used by the fetchserver code without depending on the frontend package. Most of server_test.go, which was testing features that are provided by what is now the FetchServer has been moved to the fetchserver package. To ensure that git properly realizes it as a move, the rest of server_test has been moved to frontend_test. In some cases I made copies of functions (absoluteTime, insertTestModules) instead of creating intermediate packages to contain them. For golang/go#61399 Change-Id: Ic94419f9d75f766e289cc3fb9a1521173cefb4d1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/519335 Reviewed-by: Robert Findley <rfindley@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org>
2023-08-21internal/frontend: separate fetch and 404 logic into fetchserverMichael Matloob
ServeFetch and ServePathNotFoundPage only work when a postgres database is present. Separate them out into a different fetchserver type which can be moved into a different package (in a followup cl). This will allow their behavior, which is not used by cmd/pkgsite, to be removed from that server. More importantly, their tests, which depend on a real postgres database can be separated from the tests of package internal/frontend. For golang/go#61399 Change-Id: I73677fd06750fd48580071b8a895b322d9e3ac5d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/518817 kokoro-CI: kokoro <noreply+kokoro@google.com> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2023-08-04internal/frontend: remove dependency on cloud error reporting clientMichael Matloob
This removes the dependency of internal/frontend on the cloud error reporting client, both directly, and through the derrors package by introducing a new interface Reporter that is used both to set the reporting client for internal/derrors, and on the Server. For golang/go#61399 Change-Id: Id4d4def522cda9b4e49f53cff6708019dec2693c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/514676 Reviewed-by: Jamal Carvalho <jamal@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org>
2023-08-04internal/frontend: add an interface for creating request cachesMichael Matloob
This change adds a new Cacher interface that is used to create middlewares for caching requests. This abstracts away the use of redis so that the frontend doesn't depend on redis. The tests still depend on redis for the 404 page testing logic, but the 404 page logic will be moved out into a different package so those tests will go too. The Expirer and Middleware interfaces are not present on the Cache function so that the interface can be defined in package internal/frontend without needing the dependency on the Middleware package. For golang/go#61399 Change-Id: I6518b2ed1d772cb4deda3308c4190f0f1b8a35a0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/514518 kokoro-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org>
2023-07-31internal/middleware: move the timeout middleware to its own packageMichael Matloob
This removes the direct dependency from cmd/pkgsite to the middleware package. The middleware package has a lot of dependencies but most middlewares are not used by cmd/pkgsite. There are still some middlewares used by internal/frontend so the indirect dependency still exists. For #61399 Change-Id: I09eee46b2ff13e112d24df62073074eb5aa3e901 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/511315 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-19internal/queue: split out gcp queue into different packageMichael Matloob
internal/frontend depends on internal/queue. Move the parts with gcp dependencies into its own package so internal/frontend no longer has those gcp queue dependencies. For #61399 Change-Id: I0083c31da1b367f135e53686e4c994d7c4d6420f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/510815 TryBot-Result: Gopher Robot <gobot@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2023-07-17internal/fetch: add two stdlib gettersMichael Matloob
This breaks out the behavior of getting the stdlib into its own getter, stdlibZipModuleGetter. Most (but not all) of the special cases in the fetch code for the stdlib are in the stdlibZipModuleGetter, which is installed on the frontend. For the local pkgsite command, we add a new builder for the goPackagesModuleGetter that loads the packages from the stdlib given a GOROOT. The stdlibZipModuleGetter is also installed for pkgsite in as a fallback if the goPackagesModuleGetter doesn't successfully fetch the stdlib module (I'm not sure if that's possible). Fixes #60114 Change-Id: Ida6a5367343643cc337c6d05e0d40095f79ca9e5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/507883 Reviewed-by: Jamal Carvalho <jamal@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-06-22cmd/frontend: add -local flag to run frontend in LocalModeAmine Benseddik
The frontend UI show/hide elements and links based on whether the frontend server is running in `LocalMode`. For the `frontend` this value is hardcoded to `false`. This PR adds the flag `-local` to allow starting the frontend in `LocalMode`. This is particularly beneficial for those who wish to run the `frontend` locally or self-host for internal packages. Fixes golang/go#60872 Change-Id: I355419bfef65bdbd970d7e602775d44ee8755c10 GitHub-Last-Rev: 4a8140a24336daf711e0c6500d070d27ab101198 GitHub-Pull-Request: golang/pkgsite#66 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/504336 Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Peter Weinberger <pjw@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2023-03-08internal/frontend, internal/vulns: isolate references to x/vuln repoTatiana Bradley
No-op refactor to move all code that depends on x/vuln to the internal/vuln (renamed from internal/vulns) package. This will allow us to more easily remove the dependency, as a part of the migration to the v1 database schema. For golang/go#58928 Change-Id: Ic8ac2377832d8e4a2a6afbb42729a7e10553665c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/474255 Reviewed-by: Julie Qiu <julieqiu@google.com> Reviewed-by: Tatiana Bradley <tatianabradley@google.com> Run-TryBot: Tatiana Bradley <tatianabradley@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2022-08-26internal/frontend: copy pkgsite redirect logic from gddoJamal Carvalho
Code in motion. Copies pkgsite redirect from github.com/golang/gddo and adds it as a middleware to pkgsite requests. Moving this redirect to the pkgsite service will allow us to turn down the legacy godoc-org project. After this CL is merged, the next step is to transfer the godoc.org domain to pkgsite GCP project. Change-Id: I322e9e6332dc5ee6dbbdf1e640ab3fdde5f15caa Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/425000 Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Suzy Mueller <suzmue@golang.org> Reviewed-by: Julie Qiu <julieqiu@google.com>
2022-08-24all: update for osv schema changeDamien Neil
Update golang.org/x/vuln to latest. /vuln/list, /vuln: Set "Affects:" header to a list of stdlib package names and non-stdlib module names. For example, "net/http, golang.org/x/net". /vuln: Find list of affected packages from ecosystem_specific.imports field. Perhaps this page should list modules, or modules and packages within the module, but for now just update the list to reflect the changed location of package names in the OSV. Package page, package versions tab: No changes to content, but use the ecosystem_specific.imports field for package names. Change-Id: Ib34e5f9388829c0ae3448ee14e32a725fb24cb48 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/425202 Reviewed-by: Julie Qiu <julieqiu@google.com>
2022-05-11internal/frontend: track metrics for deps.dev URL fetchJonathan Amsterdam
Create a metric for what happens when we fetch a URL from deps.dev: success, cancellation, timeout or other error. This will let us determine if the problems we see in the log are common. Change-Id: Ife282a31c9ba5347b4c9ce8e91a480badbac6aa9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/405541 Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-11-16internal/frontend: add debug handlersJonathan Amsterdam
Add handlers that: - serve basic info about the Cloud Run revision and instance - serve pprof information, so we can track memory leaks These are only live if the "debug" experiment is active, so we can turn them on and off dynamically. Change-Id: I71a14f3893066d44432cd26b0a327deddb2040d9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/364354 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-11-05go.mod,internal/frontend: switch to golang.org/x/vulnJonathan Amsterdam
Use golang.org/x/vuln, the new home of most Go vulnerability code, instead of the obsolete golang.org/x/vulndb. Change-Id: Id96054d17eb791a4a8ca419fb562fe9cad0996a8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/361209 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-10-28many: cmd/pkgsite embeds static assetsJonathan Amsterdam
The `pkgsite` command now embeds all the static assets it needs, so it need not be told the location of the static/ directory with a flag. The binary is self-contained and can be placed and invoked from anywhere. This required embedding the static/ and third_party/ directories. Since //go:embed cannot reference files outside the containing package's tree, we had to add trivial Go packages in static/ and third_party/ to construct `embed.FS`s for those directories. Also, the frontend needed to accept `fs.FS` values where it previously took paths, and `template.TrustedFS` values where it previously used `template.TrustedSources`. We ended up clumsily requiring four separate config values: - A TrustedFS to load templates. - Two fs.FSs, one for static and one for third_party, to load other assets. - The path to the static directory as a string, solely to support dynamic loading in dev mode. For golang/go#48410 Change-Id: I9eeb351b1c6f23444b9e65b60f2a1d3905d59ef9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/359395 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-10-04cmd/frontend: log redis client statusJonathan Amsterdam
Log whether we successfully connected to the redis client. Change-Id: I7bc39b6387e0674cde51280897a20dfc9f54f5d7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/353810 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-09-07cmd/frontend: add a cache for vuln dataJonathan Amsterdam
The vulndb.Client already supports caching; we just have to supply an implementation. The only implementation in golang.org/x/vulndb uses the filesystem, so we can't use it on App Engine. Provide an in-memory implementation instead. For golang/go#48223 Change-Id: I0431921dcabfb5546350dff095ae6aa5668ad892 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347969 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-09-07internal/frontend: display vulnerabilities on package pageJonathan Amsterdam
Under an experiment, look up and display a package's vulnerabilities on its main page using the client provided by the golang.org/x/vulndb module. For golang/go#48223 Change-Id: I310440db16f8ad5fe582fc8ab42999e874f3ca88 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347949 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-09-07internal/fetch: get source info from module getterJonathan Amsterdam
Make it the ModuleGetter's responsibility to provide links to source files, instead of passing around a separate source.Client. This will allow getters that fetch from disk to serve those local files. For golang/go#47982 Change-Id: I6c7cd7890b03ad61d9410850a510c1c9a63f1c9a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347749 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-09-03cmd/frontend: remove i18nJonathan Amsterdam
Remove the Language middleware, effectively using English for all i18n. Revisit if/when we internationalize the whole site. Change-Id: I0ad083cc057a33206c507856578983f44959cf69 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347559 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-09-03internal/{frontend,middleware}: group import count in searchJonathan Amsterdam
- Add a middleware that extracts the preferred i18n information from the client. - Use that information to format the imported-by count displayed in search. Change-Id: Id6676c135cb6b094c53a039206ef4702256120d6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347553 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-08-25internal/fetchdatasource: rename from datasourceJonathan Amsterdam
Rename the package and type by including the word "fetch," to describe what it does and distinguish it from other DataSources. For golang/go#47780 Change-Id: I7c674d8ba3dc16084a857039b0cc2b3147f27a29 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344953 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-08-25internal/datasource: consolidateJonathan Amsterdam
Merge ProxyDataSource and LocalDataSource into a single type, DataSource. Combine and simplify tests. For golang/go#47780 Change-Id: I3510fee3a3d786705a2306a6233b352e5af40076 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344952 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-08-24internal/datasource: combine datasource packagesJonathan Amsterdam
The proxy and local datasource implementations can share a lot of code. Put them in the same package to facilitate that. For golang/go#47780 Change-Id: Ic67d647decd7056650120d47fba9f2351426142b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344530 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-08-06all: delete redis HA clientsJulie Qiu
The redis HA was used by search autocomplete and is no longer used by anything. Change-Id: I39a2c81c47da53823d7b668a980159c4726c6b13 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/340393 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-07-19cmd,devtools,internal/config: set log level in config.InitJulie Qiu
log.SetLevel is now called in config.Init, so that it also applies to logs in the Init function. Change-Id: Id552923b4d81bb1678b8ffa72f1b1d858de559c1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/335257 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-06-12internal: switch static reads from content/static to staticJamal Carvalho
Change-Id: Icec167d645b9178375b959491206277e13b455cf Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/327283 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-04-27cmd/frontend/.gcloudignore: ignore some directoriesJonathan Amsterdam
Change-Id: I7485cdd629c678e5b323697fd68fd78ae1e51269 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/313709 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-04-20cmd,internal/frontend: remove legacy playground codeJamal Carvalho
Now that interactive playgrounds have been rolled out the legacy code can be removed. Change-Id: I6bab20a24364ba996197ac4bc4553c779e4fab1d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/311849 Trust: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-03-05cmd: add e2e to .gcloudignoreJamal Carvalho
Change-Id: Id211af73d327d92d3cf361b5909619ac14856860 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/298751 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-02-19internal/frontend: do latest-major-version logic in main serving pathJonathan Amsterdam
Instead of using middleware to replace information about latest major versions in the HTML, insert them in the usual way, via templates. This is possible because the worker invalidates the cache when a new latest version comes in. Delete the latest-version middleware. Fixes golang/go#44210 Change-Id: I348a25d6b8777bad555e034d38ddb4137eb6ff18 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293009 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>