aboutsummaryrefslogtreecommitdiff
path: root/internal/frontend/server.go
AgeCommit message (Collapse)Author
5 daysinternal/frontend: add v1/search endpointEthan Lee
Change-Id: I53fc1becbee21fcc586e00f4e3d93f636eaaba4c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/764960 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Auto-Submit: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Ethan Lee <ethanalee@google.com>
5 daysinternal/api: refactor error handling to increase consistencyEthan Lee
- Refactored error handling to avoid leaking internal implementation details. Database and system errors are masked by falling back to standard HTTP statuses but still logging the entire error context. - User facing error messages can now be specified within the Error struct. - Added helpers in types.go to simplify error construction. - Updated ServeModuleVersions to explicitly return 404 when no versions are found. - Expanded test coverage in api_test.go to include 404 and 400 edge cases. Change-Id: I89c4be3941126c15df6aefdd21e4bbd2d3b23be1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/764820 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ethan Lee <ethanalee@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
13 daysinternal/api: consolidate error response handling for all handlersEthan Lee
- Ensure that all errors are wrapped correctly and served as a json error response. Change-Id: I588552c755fb2135916da95dec6d37238d030d39 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/758821 Auto-Submit: Ethan Lee <ethanalee@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>
2026-03-30internal/api: implement vulnerabilities endpointEthan Lee
- Create vulnerabilities endpoint using server vuln client. Change-Id: I234c96851f7682a13bda97aa3e5018d0439e05da Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754866 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ethan Lee <ethanalee@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2026-03-30internal/api: implement package imported-by endpointEthan Lee
- Implement ServePackageImportedBy handler and GetImportedBy and GetImportedByCount datasource methods. Change-Id: I8c4cc65fbff7172eaf48e5426e4f3f41c82bd38e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754865 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ethan Lee <ethanalee@google.com>
2026-03-26internal/api: implement package symbols endpointEthan Lee
- Introduce a new ServePackageSymbols handler that utilizes the new db.GetSymbols method. - Consolidated module resolution logic shared by ServePackages into resolveModulePath. - Updated Datasource with GetSymbols, which provides a more efficient way to retrieve all symbols for a package at a given version and build context. This differs from the existing getPackageSymbols, since that will return symbols for the latest release/compatible version. - Refactored packageSymbolQueryJoin into a generic helper by removing hardcoded version filters. This allows GetSymbols to query for any specific version, while getPackageSymbols was updated to explicitly include release-only filters to preserve its existing behavior. - GetSymbols still utilizes the same underlying packageSymbolQueryJoin, but it will also attempt to match the most relevant BuildContext for the query. It will also provide a mapping of parent and child symbols. Change-Id: Ib18d2511d24ac6bc5b75c7b3809c4ce126245036 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754864 Auto-Submit: Ethan Lee <ethanalee@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>
2026-03-24internal/api: implement search endpointEthan Lee
- Implement ServeSearch method and pagination for search results. Change-Id: I109d0861b5fa0cfbc20ce20308561ef6b5616405 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754860 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> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2026-03-24internal/api: implement module packages endpointEthan Lee
- Implement the ServeModulePackages handler and introduce GetModulePackages to return the list of packages for a given module version. Change-Id: I20c1618e2fdbf0126cb913665a1d7457b8951177 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754863 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> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2026-03-23internal/api: implement module versions endpointEthan Lee
- Implement module versions endpoint using ds.GetVersionsForPath - Introduce paginate helper to generalize paginaton logic - Update fakedatasource to correctly use V1Path to return all versions Change-Id: Icc028bf8ca9c13978bb6eba84afe9736ccd6bcee Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754862 Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ethan Lee <ethanalee@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2026-03-19internal/api: implement module metadata endpointEthan Lee
Change-Id: Id6b8686012803c88c9b7ea71e4b1c0058b7967b0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754861 Auto-Submit: Ethan Lee <ethanalee@google.com> 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>
2026-03-19internal: instantiate v1/package/{path} endpointEthan Lee
- Create handler for serving v1 package endpoint. - Create tests to verify endpoint behavior. Change-Id: I72701cb15d83baf4e31ed918c198adf347605a4a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754420 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Auto-Submit: Ethan Lee <ethanalee@google.com>
2026-01-15internal/frontend: add module and package metadata to codewiki linkEthan Lee
- These metrics can provide further granularity for filtering usage patterns. Change-Id: I110854ac2cbcef54d02f1dd02cb27b917ab17705 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/735800 Auto-Submit: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@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-11-20internal/frontend: add additional pprof memory handlersEthan Lee
- Add additional handlers for heap, allocs, blocks and goroutines. Change-Id: I3c7e46cad6a34aca07f61d6dc3026ac4c1da113f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/721760 Auto-Submit: Ethan Lee <ethanalee@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com> 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-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-08internal/frontend: handle file paths with spacesSean Liao
http.Handle generally handles the escaping for us, except for the first space which is used to split out the method. Fixes golang/go#73534 Change-Id: I588292ce5ffa6228f57c8e2c5f0ac5e73c27b853 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/668875 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2025-02-06internal/frontend: register POST paths for playground fmt and compileSean Liao
Fixes golang/go#70910 Change-Id: I8a59fb1bd0d166cc9de2c47c0b5a29b2798d04e9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/645577 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> kokoro-CI: kokoro <noreply+kokoro@google.com>
2024-09-30internal/frontend: require GET for most routesJonathan Amsterdam
Add a GET method to the patterns for most frontend routes. We omitted a few where we're not totally clear on what the client may be sending. Change-Id: I3f300b7d3753fd4009a60855c7a15b24c5e27dd6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/616395 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2024-02-26internal/frontend,static/frontend: remove styleguideJonathan Amsterdam
There was once a plan to serve a styleguide for the formatting of this site, but it never happened. Change-Id: Ibd15abe9e3a16abc8cedde1bee2751f334abdbe9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/566419 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>
2023-12-19internal: move templatecheck tests to their own packageMichael Matloob
The new package the templatecheck tests are in is not a transitive dependency of cmd/pkgsite, so that cmd/pkgsite no longer has a transitive test dependency on github.com/jba/templatecheck. To make this work we had to expose the templates from the internal/frontend and internal/godoc packages for the tests to use. For golang/go#61399 Change-Id: I1290ec24b53af77a82671c8fc068867e12857ce3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/550936 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: Jonathan Amsterdam <jba@google.com>
2023-11-08internal/frontend: add OpenSearchSteve Wills
Based on https://developer.mozilla.org/en-US/docs/Web/OpenSearch Fixes golang/go#61986 Change-Id: I78d8590f8f6844170345738394a65887970627ac GitHub-Last-Rev: e34f32f1c7f6b40b7d8df56fa4380af6c9d8727d GitHub-Pull-Request: golang/pkgsite#83 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/539896 TryBot-Result: Gopher Robot <gobot@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Cottrell <iancottrell@google.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
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-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-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-15internal/frontend: move urlinfo to its own packageMichael Matloob
These are also being moved so that the code in fetch.go can be moved to a new package without depending on internal/frontend. A couple of functions that were only used by details.go are moved to that file. For #61399 Change-Id: Ic299069ea0b3aaeb80dbbf7f1ed4fedf7d1787df Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/518816 Reviewed-by: Robert Findley <rfindley@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-15internal/frontend: move base types to their own packagesMichael Matloob
This change moves serverError, basePage and errorPage out to different packages so that the fetch page logic can use them but be moved out of internal/frontend. For golang/go#61399 Change-Id: I72ccee40d1847d3211ca851a320530c4c1dcf2e2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/517976 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> 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/middleware: move stats to its own packageMichael Matloob
Make a package internal/middleware/stats for middleware.Stats and middleware.ElapsedStat. This is part of removing the dependency from internal/frontend on internal/middleware. For golang/go#61399 Change-Id: I44afbfc9b9e28e1caabab8fe700376ec026c863d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/514521 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com>
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-03-15cmd/pkgsite: hide irrelevant content in local mode; add quick linksRobert Findley
This CL contains several UI improvements when running pkgsite in local mode via cmd/pkgsite: - hide irrelevant or inaccurate content - fix a bug using -gopath_mode (trim the `go env GOPATH` output) - fix panics navigating to vuln pages - link the GO button to the root page, rather than go.dev - add quick-links to the homepage to browse local modules Also: - add -dev and -static flags, to facilitate development - replace TestBuildGetters with more cases in TestServer - fix some redundancy in setting the <title> element for pages; consolidate on using the basePage.HTMLTitle value Updates golang/go#40371 Change-Id: I459a0d0fd39897dd4f902dd023aec653a3fb12cd Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/475755 TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Run-TryBot: Robert Findley <rfindley@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>
2023-02-22internal,static: upgrade esbuildJamal Carvalho
The previous version of esbuild would sometimes out non-deterministic versions of minified files. This would generate large diffs when make small changes to script code on different machines. Change-Id: I30540088ad2a259e4c086b18505016a95937dc2f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/469855 Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2022-11-15all: convert interface{} to anyHana (Hyang-Ah) Kim
Change-Id: I1f3b7cc8899c7707abb01e3d14807c37c3451382 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/449695 TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-10-21internal/frontend: address problems flagged by staticcheckHana (Hyang-Ah) Kim
Change-Id: Ibc890184f8b9a0ec47525dbe07119f34a6001ea7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/444681 Reviewed-by: Jamal Carvalho <jamal@golang.org>
2022-10-19internal/frontend: use frontend.searchMode to determine route tagJamal Carvalho
The search mode is detected automatically when it is not set by the client. This ensures that all searches are correctly tagged when coming from the homepage where the mode is not explictly set. Change-Id: I89954e890175de8cff7be2e8ef773d565c6b845c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/443338 Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-10-13internal/frontend: add separate tag route for search page typesJamal Carvalho
To improve monitoring of the latency of these pages we separate the search modes into different request tags. Change-Id: I3f0cf887b78fa3e6c065324bd5473433b963769e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/442555 TryBot-Result: kokoro <noreply+kokoro@google.com> Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-10-04internal/frontend: fix vuln page cache handlerJamal Carvalho
The http.StripPrefix handler stripped the /vuln prefix from the cache keys of vuln pages causing a collision with the key for the homepage / and the vuln portal /vuln/. Removed the strip prefix handler. Change-Id: Ib8d550e925d446f1a53ffc4196b3911981359bc3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/436758 Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Jamal Carvalho <jamal@golang.org>
2022-09-28internal/frontend: add vuln pages to redis cacheJamal Carvalho
Change-Id: I1d4126a7f040c8926ab573a915d7fc1eac61619d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/435376 Reviewed-by: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2022-09-21internal/frontend: copy search mode when replacing basepageJamal Carvalho
The search mode must be set on the basepage to properly switch symbol search queries to the symbol search results page. Change-Id: I98d22baa501d728983ecc7a97eddfb35357ce9a4 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/432420 Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2022-09-20internal/frontend: refactor serveSearch for testingJonathan Amsterdam
Split serveSearch into two functions: one computes the action to take (redirect, serve a page or error) and the other carries out the action. This makes it much easier to test the search logic, since we don't have to examine HTML output, just the searchAction struct. Add a test that verifies much of the high-level search logic: various errors, when to redirect, etc. Change-Id: I56d31264fd511420c94961ed6de4e464ebafd27b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/431176 Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2022-08-16internal,static: create vulndb portal landing pageJamal Carvalho
Added a landing page for the vulndb web portal at pkg.go.dev/vuln. The page displays the five most recent vulnerability reports and links to the full list at pkg.go.dev/vuln/list. Change-Id: Ib3adb0573fa668e0bf27a5980ed3ee9450608c86 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/422907 Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julieqiu@google.com>
2022-06-30internal: re-enable staticcheck SA1019Jamal Carvalho
Replaces use of strings.Title with a caser from /x/text/cases. Change-Id: I35f9f96720bb84b40cef3d7bfda1a7370991c5cd Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/413317 Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2022-02-01internal/frontend: redirect /vuln to /vuln/listJonathan Amsterdam
Change-Id: I70f126ef2a442ac499a78fe4773758bf3831630b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/382155 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-11-22internal/frontend: add cgoup memory infoJonathan Amsterdam
Change-Id: Ifc8796ed232876a42ca1957283621815a7f53cdc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/365659 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-11-22pkgsite: add /about page, copied from go.dev/aboutRuss Cox
go.dev/about is mostly about pkg.go.dev, which has always been odd. Fix it by creating pkg.go.dev/about with the same info. Once this page is live, go.dev/about will start redirecting to pkg.go.dev/about. Change-Id: Ib49b688f8775cc3e83a07018ce038779935ae4c1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/364974 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-11-19internal/frontend: add memory stats to debug handlerJonathan Amsterdam
Also, change the path to "_debug" because there are stdlib packages at "debug". Change-Id: Id72c86a34e9cfec3d1f4a889af4549ba4119279e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/365657 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-11-19internal/frontend: require header value for debug pagesJonathan Amsterdam
Instead of making the debug pages visible based on an experiment, require a "secret" header value instead. This will make them available at all times in all environments, without a config change. Context: debugging the memory creep we observe on Cloud Run the prod frontend. Change-Id: If78798d838ce774f51117668bfb1d4dd91bfa817 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/365654 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>