aboutsummaryrefslogtreecommitdiff
path: root/cmd/golangorg/server_test.go
AgeCommit message (Collapse)Author
7 dayscmd/golangorg: use _goroot.zip during deploy tests tooDmitri Shuralyov
The deploy process constructs a _goroot.zip file which is used as the source of main Go repository content when serving go.dev. Start using the same _goroot.zip file when running tests in Cloud Build. Also move the flag.Parse to happen at the top of main, before some of the flag values are accessed and potentially overridden. For golang/go#78211. Change-Id: Iaf182301836917d062c5f4c329db6bbc171415da Reviewed-on: https://go-review.googlesource.com/c/website/+/763840 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> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
7 dayscmd/golangorg: temporarily skip check for "{{raw <code>" bad escapingDmitri Shuralyov
Even though the deployed version of go.dev/doc/godebug no longer has the "{{raw <code>" bad escaping, TestAll still fails during the deploy process. This is because it turns out that it doesn't use the same _goroot.zip file that the website uses to serve content. Instead, it uses GOROOT from the go version used to run the tests, and that version doesn't have the fixed godebug.md yet. For now, to fix the deploy process breakage sooner, disable the check that was recently added in CL 746741. For golang/go#78211. Change-Id: I5052f6ef2bc283e8751dca39f5131eb66c67cff3 Reviewed-on: https://go-review.googlesource.com/c/website/+/763740 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: David Chase <drchase@google.com>
2026-03-25cmd/golangorg: catch instances of bad escaping due to template useDmitri Shuralyov
The {{raw `…`}} sequence is commonly used in Markdown templates to include a block as is. If such a sequence is used in a Markdown file while its 'template' field in metadata is accidentally set to off (the new default value as of go.dev/cl/733500), it gets rendered as '{{raw <code>' HTML which is almost certainly not what was intended. It should be possible to catch these in TestAll. For golang/go#78211. Change-Id: I7bba708bc41a6421f3aae88e10d30574de7a9294 Reviewed-on: https://go-review.googlesource.com/c/website/+/746741 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-25cmd/golangorg: include GOROOT/doc files in TestAll checksDmitri Shuralyov
Most of the go.dev content is in the _content directory of x/website, but some of the pages (e.g., go_spec.html, asm.html, godebug.md, etc.) canonically live in the main Go repository. Extend TestAll to help catch problems automatically in those files too. For golang/go#78211. Change-Id: I48ac3f8b2338ef1300461a860fe2cc4c2c30ac02 Reviewed-on: https://go-review.googlesource.com/c/website/+/746740 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-25cmd/golangorg: support absolute paths in testTreeDmitri Shuralyov
The use of strings.TrimPrefix on filepath.ToSlash output works on all OSes when testTree is given a relative path like "../../_content", but it doesn't work on Windows if testTree is given an absolute path. The next change will do that (in order to process GOROOT/doc content), so prepare for it by migrating to filepath.Rel to compute relative path. For golang/go#78211. Change-Id: I2117d916e1c4112bfbd667597e32622039040dd0 Reviewed-on: https://go-review.googlesource.com/c/website/+/756501 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-08cmd/golangorg: serve gopls docs at go.dev/goplsAlan Donovan
The go.dev/gopls endpoint serves the gopls/doc directory at the latest release of gopls; the tip.golang.dev/gopls endpoint serves the latest x/tools commit. The GOLANGORG_LOCAL_X_TOOLS environment variable specifies a local directory, overriding the use of git, for previewing local doc changes. Also, a command to recursively check links within the go.dev/gopls subtree. Fixes golang/go#68977 Change-Id: I5d92e6f0e5fdbed721a57f0a1ace2ac98e562fc8 Reviewed-on: https://go-review.googlesource.com/c/website/+/685635 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-03-10cmd/golangorg: drop "at least Go 1.19" checkDmitri Shuralyov
The go.mod file enforces Go 1.23.0 or higher. Also drop the obsolete skip for /doc/godebug. For golang/go#54200. Change-Id: Iaab9bf954dfae72074b5c9b7cdfd5128871e62d6 Reviewed-on: https://go-review.googlesource.com/c/website/+/655655 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
2025-03-03_content/doc/go1.24: add release dateDmitri Shuralyov
The month and year alone should be enough granularity for the purpose of the introduction to Go 1.24. In this case, February 2025 refers to when the go1.24.0 major release came out, but we released pre-release versions even before then. Link to the dedicated release history page where full details and exact dates can be found. Add a test so we don't forget. For golang/go#68545. Fixes golang/go#54170. Change-Id: Ia2bceee9208094b0623add6696585592f4399893 Reviewed-on: https://go-review.googlesource.com/c/website/+/654015 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-12-05cmd/golangorg: suggest relative links for /issue/ and /wiki/ casesDmitri Shuralyov
The test already requires "https://go.dev/page" links to be written as relative "/page" ones; it looks like an oversight not to do that right away in these two cases. Change-Id: I81f16e6b30db31351cf4bbe941ed01de969d6cd3 Reviewed-on: https://go-review.googlesource.com/c/website/+/633855 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-12-04cmd/golangorg: suggest working new issue link in TestAllDmitri Shuralyov
https://go.dev/issue/new already redirects to GitHub's issue tracker with the "/choose" suffix, and https://go.dev/issue/new/choose is 404. Improve the test to handle this case and suggest the right fixed URL. Change-Id: I15a7c80f0acbe3b24f834a6b87282b25cb4e4ea0 Reviewed-on: https://go-review.googlesource.com/c/website/+/633835 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2023-12-20all: fix and test for references to github.com/golang/go/issues and wikiRuss Cox
Insist on the canonical /issue/ and /wiki/ links instead. Change-Id: I7a2eedda69bc3fcd11466722a41f00c9dbaf283f Reviewed-on: https://go-review.googlesource.com/c/website/+/550323 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-12-15_content: serve wiki pages on go.devRuss Cox
The wiki pages have been copied to go.googlesource.com/wiki and will be code reviewed using Gerrit, like other Go repos. Unlike other Go repos, self-review will be permitted, and there is no requirement for Googlers to be involved to make a change. These relaxations are possible because the wiki has no production code. The set of wiki +2'ers is a superset of the usual code +2'ers. Fixes golang/go#61940. Change-Id: I01823720091fbaa24e95e9c82abeaadba867a17c Reviewed-on: https://go-review.googlesource.com/c/website/+/518297 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-12-08cmd/golangorg: check for invalid or broken links in served HTMLRuss Cox
Test that links are to /foo not https://go.dev/foo and also check that the links actually point at real pages. Manually fix problems that the test found. For golang/go#37047. Change-Id: I825eec3c2cadb9d259caff51cd893f3023ab533a Reviewed-on: https://go-review.googlesource.com/c/website/+/548059 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2022-08-03internal/pkgdoc: fix rendering of generics like atomic.PointerRuss Cox
Fixes golang/go#54200. Change-Id: I407b7368c524746b0f14c6ec5495c509794e331a Reviewed-on: https://go-review.googlesource.com/c/website/+/420794 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2021-11-22go.dev: merge go.dev/_content into root _contentRuss Cox
Many renames. And then adjust references. Change-Id: I4d03c76dbc0bf4d070208d568861ee820904c0dc Reviewed-on: https://go-review.googlesource.com/c/website/+/365097 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-18cmd/golangorg: move blog from blog.golang.org to go.dev/blogRuss Cox
This is the first of a sequence of consolidations of web sites into the single site go.dev. An accompanying blog post (next CL) will explain the change. The blog/_content tree moves to go.dev/_content/blog. The *.article files were converted to *.md files using rsc.io/tmp/blog2md. The old dot directives are now template function invocations, so that blog content files are now exactly the same format and semantics as regular site content files. All the old blog redirects are carried forward, of course. Also add exhaustive test that every .md file renders correctly. Also rename rawhtml to raw, because it gets used for raw Markdown too. The raw Markdown issue is working around a bigger problem (html/template is not really right for Markdown) that we will have to solve at some point, but not in this CL. Change-Id: Ifa9b3b8d656a72af30d0d4e57e4c7bc8dacbc386 Reviewed-on: https://go-review.googlesource.com/c/website/+/342091 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-17cmd/golangorg: fix ref/mod to be template-safe and add exhaustive template ↵Russ Cox
syntax test Fixes golang/go#47751. Change-Id: I28a979eee3c75749449291d0b60bc64a6d761ae0 Reviewed-on: https://go-review.googlesource.com/c/website/+/342899 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-17cmd/golangorg: take on serving of go.devRuss Cox
This CL merges go.dev/cmd/frontend into cmd/golangorg, now that they share the same serving framework (internal/web). Change-Id: I367d5c79b993f25ce411544b00f6db6d820290e0 Reviewed-on: https://go-review.googlesource.com/c/website/+/339404 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Website-Publish: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-12cmd/golangorg: serve tip.golang.org directly from GerritRuss Cox
This CL enables the code, committed in an earlier CL, that serves tip.golang.org from an in-memory copy of the Go repo, updated by a background loop, which will let us retire the more heavyweight "deploy a whole new app in a loop" that we currently use for tip.golang.org. When this CL is committed, the "deploy a whole new app in a loop" logic will deploy this new code, which will then start using the in-memory copy, even though it is also being updated on each change. At that point it will be safe to take down the app-updating loop entirely, letting the default app do the serving. Change-Id: Ica5cffd684c45d4a5b059772700a0a608f832bad Reviewed-on: https://go-review.googlesource.com/c/website/+/335049 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Website-Publish: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-23all: promote new app deployments only after they become readyRuss Cox
There are differences in the App Engine environment that cannot be adequately simulated elsewhere. Although we do the best we can with testing locally, there will always be differences. The old makefiles deployed the site, then ran a regression test against it, and then promoted the tested version. This change does the same. The testing has moved into the web server proper so that it can test the handler directly and thereby check things like the responses on different domains. The go-app-deploy.sh now always deploys --no-promote, only promoting after a self-test passes on the deployed site. Unlike the old check which only applied to golang.org, the new pre-promotion testing happens for all the sites. Also factor out GoogleCN into internal/web, because we needed to modify it (to avoid internal/webtest's requests being diagnosed as coming from China) and there were too many copies. Change-Id: I0cde0e2167df2332939908e716ddb6bf429f2565 Reviewed-on: https://go-review.googlesource.com/c/website/+/329250 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-17cmd/golangorg: factor out main handler setupRuss Cox
Also avoid use of http.DefaultServeMux entirely, for clarity about what is registered. Change-Id: Ibd7ccd7a6c3cb6b79e94b77570ad016a1be11f0c Reviewed-on: https://go-review.googlesource.com/c/website/+/328012 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Website-Publish: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-17cmd/golangorg: merge into single source fileRuss Cox
There is so little left here that the file boundaries make no sense anymore. Move all the functions into main.go. registerHandlers was inlined instead of copied. Change-Id: If91a5d1dc75834747b9d803ec44790950d503aed Reviewed-on: https://go-review.googlesource.com/c/website/+/328011 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>