aboutsummaryrefslogtreecommitdiff
path: root/internal/middleware
AgeCommit message (Collapse)Author
16 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.
2026-03-27all: run go fix -testingcontextHana Kim
Change-Id: I8812f020b84ce40d577116199435af9e62c980f7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753434 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>
2026-03-26all: run go fix -stringsbuilderHana Kim
Change-Id: I839e47c2b39ee592909f7ecb03603d4fb1d1954b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753430 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>
2026-03-26all: run go fix -slicescontainsHana Kim
Change-Id: I14479d9e612dfa7eed9188206746af5b51c10201 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753428 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-26all: fix rangeintHana Kim
Change-Id: I58ed5e7d2a3bbc13bc389ac7239737e18856dbfe Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753427 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ethan Lee <ethanalee@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.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>
2024-09-04go.mod: upgrade to go 1.23Jonathan Amsterdam
The go.mod major version now matches what we use for Dockerfiles. The version of staticcheck that works with Go 1.23 revealed several uses of deprecated functions. Some of these were easy to change, but other require more care and will be addressed in some later CLs. Change-Id: I7f8344e419b8be6351d51db90faa64cef04057a0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/609142 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>
2024-03-05worker: minor improvements to main pageJonathan Amsterdam
Move experiment section to bottom (it is relatively uninteresting). Sort requests by age. Change-Id: I7c0df9a9bfa4baa7b2960c5008c2e9ebc6a9d6ab Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/568240 kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org>
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-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-09-08interna/middleware: synchronize instead of sleeping in TestSetAndLoadExperimentsBryan C. Mills
Fixes #62530. Change-Id: I06516921c170a606e9fe663b6cd8a248cd891a73 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/526173 TryBot-Result: Gopher Robot <gobot@golang.org> Commit-Queue: Bryan Mills <bcmills@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> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
2023-08-09internal/middleware/stats: make TestStats more reliableMichael Matloob
TestStats depended on having a big sleep in the middle and then expecting that the time taken to the last byte was dominated by the sleep time. Instead of doing that use upper and lower bounds where possible to determine the range MillisToFirstByte and MillisToLastByte should fall between Fixes #61770 Change-Id: Ie266e34165670827035fb2a05e32c2aee268a2e0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/517975 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-08-07cmd/log: move stackdriver logging to its own packageMichael Matloob
This change breaks out the stackdriver logging to its own package. It also only does logging of trace ids and labels to the stackdriver logger, to keep the logging interface simple. For golang/go#61399 Change-Id: I9a25d0c6391d1667fe476e5fdc30fc057f07c40f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/515375 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-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: delete Language and languageTagMichael Matloob
The Language middleware isn't referenced anywhere else in the code, so the context tag can't be set anywhere and languageTag must always be returning English. Just hardcode English everywhere instead For golang/go#61399 Change-Id: Id8cee6b9fb87a7f8f3460fb6eaf2f14ea0af7c8d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/514675 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@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-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-18internal: remove repetitive wordscui fliter
Change-Id: Ie5a688c08ba46018f0fa8f5a1af495e9c29fd684 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/509695 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Robert Findley <rfindley@google.com>
2023-07-10internal: add build tags guarding code that doesn't build on plan9Michael Matloob
This is intended to get the misc-compile-plan9 builder passing. internal/static adds a stub for plan9 that panics since the esbuild module it uses doesn't build on plan9. A bunch of tests that use miniredis are build tagged since miniredis doesn't build on plan9 The setup of testDB in server_test.go is moved to its own file frontend_test so it can be used by other test files in the package while allowing us to disable server_test which uses miniredis. For #61209 Change-Id: Iacb39180459e31c946d02b62e8c03e91368c087a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/508448 TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Michael Matloob <matloob@google.com>
2023-02-01deploy,devtools: upgrade to go1.20rc3Jamal Carvalho
- Disabled staticcheck while go1.20 is unsupported. - Fixed out of bounds error in doc html parsing. - Fixed test issue related to rand package changes. Change-Id: Ib7b30ed9c40505a5a51d986426f0e41e53a298b1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/464296 TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Jamal Carvalho <jamal@golang.org>
2022-12-02internal: don't report on vulndb errorsJamal Carvalho
A 500 response from the vulndb is not actionable for pkgsite. If vulndb is down, the uptime checks will alert the team. Change-Id: I4bacf4cd30d1522c21228906a9b16fccc86ac106 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/451361 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Jamal Carvalho <jamal@golang.org> 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-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-06-17many: re-enable staticcheck and fix problemsJonathan Amsterdam
Most of the checks were about io/ioutil. There were a couple of other minor ones. I didn't address the check for strings.Title; instead, I turned off that check globally with a staticcheck.conf file. Change-Id: I286a6894fb1fd891818ab9e451c891f52a3828fc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/412675 Reviewed-by: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2022-04-11all: gofmtRuss Cox
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: Ia9e71e7ecac75822ff43d6c7e60f512442a5fa50 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/399617 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2022-03-16static/frontend: fix close button on modal dialogJamal Carvalho
I was able to reproduce the issue by simulating a slowdown on the dialog polyfill request. The request is small enough and has a long cache life so any page load performance decrease should be imperceptible and only affect first time pkgsite visitors. Fixes golang/go#50895. Change-Id: Id8b8480ae8944528c267a5fedbe12c8fec785758 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/392954 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2022-03-07many: use strings.CutJonathan Amsterdam
Change-Id: I63aff7182ffba765bbd5b104089562b04bff0960 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/388956 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>
2022-01-13static/shared: fix modal errorsJamal Carvalho
Fixes golang/go#49556 Fixes golang/go#49455 Change-Id: I5e06794e4244d54d1c1de7b32025d9d90f986b1e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/378096 Trust: Jamal Carvalho <jamal@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com> Run-TryBot: 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-09-10static: search sticky headerJamal Carvalho
Created a sticky header for the search results page. The new header mimics the behavior of the header on the unit page. Change-Id: If8015c0f46c83c6bfb306d17a77f94fb5b9b5f4a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/348934 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-09-07many: replace most uses of strings.SplitN with CutJonathan Amsterdam
In most cases Cut(s, sep) is clearer than strings.SplitN(s, sep, 2). Change-Id: I375c15f778e43ff25b5b74c9ad0e96dac4615786 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347889 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-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-23static,internal: remove new-unit-layout experimentJamal Carvalho
Change-Id: Ib7d3a51fdc427cabcbec998130c6973497c1a750 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344394 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-08-09internal,static/frontend: update search page UIJamal Carvalho
Package and indentifier search are split into separate templates and the UI is updated to match the design spec. For golang/go#47321 Change-Id: I76cf1c71913b34e635e40e90a34235429548b59d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/340475 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-07-29static,internal: dark mode bug fixesJamal Carvalho
- Fixed cookie parsing regex. - Fixed icon css selector. - Added cache busting param to css hrefs. Change-Id: I345478eea85974e78d4649954880e3a422b20ce3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/338271 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-07-28internal,static: add keyboard shortcut to override color schemeJamal Carvalho
A keyboard shortcut is added to the site that allows a visitor to toggle the color scheme. After pressing the "t" key a cookie is set containing the preferred color scheme which will override the systemwide preference setting and persist across page views. Fixes golang/go#47423 Change-Id: Idf95bb8e4447389537cb7973d9e6b84f13beaf1a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/337870 Trust: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-07-19internal,static: update search page styles to design specJamal Carvalho
The template now hides the list of additional packages in a module and shows more on visitor interaction. Change-Id: I09280f64e34b887b429e93ca706539aebafee6a8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/335494 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-07-14internal,static: separate styleguide from unit templateJamal Carvalho
The styleguide has diverged from the unit page enough to separate the templates. The shared styles and scripts are imported directly in the styleguide template. Change-Id: I03c421d10ad015242a348a44614cbf397c9a849b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/334114 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-06-14static/frontend: update unit tab asset urlsJamal Carvalho
Change-Id: I57661293503a3fccf18280029715773f9d546696 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/327301 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> Reviewed-by: Jonathan Amsterdam <jba@google.com>
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-06-12internal/dcensus: add LatencyJulie Qiu
There are several places where we need to compute the latency measurement for recording an opencensus measurement. A dcensus.Latency function is added so that we can ensure latency is being calculated in the same way for all measurements. Change-Id: Ic138f29106f88c9c468084816d8856e47bbd7cc2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/247359 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-06-09content,internal: prepare badge page for dark themeJamal Carvalho
Updates badge template to use shared styles for form elements, icons, and colors to simplify transition to dark theme. Change-Id: I123691c6e1e5372ad0512a99656bed324ea684b6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/326050 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-06-09content,internal: move worker UI code to worker directoryJamal Carvalho
The html,css, and js directories in content/static now contain only legacy code. Updating the worker look for static assets in content/static/worker. Change-Id: I94d38c711badeb60a4b80cdf25e1aaf4e8de6adc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/325852 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-06-09content/static,internal: cleanup UI directory layoutJamal Carvalho
Establishing a convention for the static assets where shared component code is prefixed with an underscore while entry points like badge, error, and fetch pages are not. This will make it easier to identify which directories contain pages and where changes in a directory could have an effect on multiple pages. Change-Id: Ib93a97da8ae1cdc6c93f1a9ecc5c98f113403b05 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/325849 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-06-09content,internal: move main-layout into unit directoryJamal Carvalho
The name main-layout implies that it is the layout for all pages on pkgsite. Also, importing the main layout into the base css file results in unused styles loaded with non-unit pages. Moving the main-layout UI into the unit template to avoid any confusion and prevent style bloat. Change-Id: I3edaf69f9387b27f6b3359bd53929a7252ed29a6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/325582 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-06-09content/static: refactor unit page to use new layoutJamal Carvalho
The unit page is refactored for use with the base page layout. The new layout addresses usability issues caused by the current responsive breakpoints and cleans up stylesheets by removing dead styles and componentizing UI code. Viewports below 1280px will have a single column stacked layout. Viewports between 1280px and 1792px will have a two column layout with the navigation outline in the right sidebar. At 1792px we'll render a three column layout. For golang/go#44172 Change-Id: Ic49107f02c6cf0bcdfc42f8668df4f591cebe6a9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/325571 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-06-09content/static: copy unit page files into new layout directoryJamal Carvalho
Copying the unit page files into a new directory to prepare for the layout changes to the unit page. Change-Id: Ib37fe07d6fb13734ce3ec7476037a88f0bc0a218 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/325570 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-06-07content,internal: update pages to use new base layoutJamal Carvalho
Moves pages into domain specific directories and updates the template parsing logic to begin the switch to the new base layout. The unit page migration will come in a later CL. Change-Id: I424643146aacaefd61e88cb9a767b9d4b581aa5e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/324391 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-06-07content/static: update base styles and componentsJamal Carvalho
This change updates various elements of the base styles for new components. The header and footer for go.dev had some updates that were missing from pkg.go.dev so I've copied the related go.dev markup, styles, and scripts into the pkgsite repo. Change-Id: I84e58c52323ce5bacc5edeab07e9390123f2cfa2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/324269 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>