Граф коммитов

150 Коммитов

Автор SHA1 Сообщение Дата
Russ Cox ad69553815 internal/tour: fix go.dev/tour
The playground js was coming from
godoc instead of the updated copy in go.dev.

Change-Id: I26be8634b0e5d453b966be758f08c15b4bc7ca72
Reviewed-on: https://go-review.googlesource.com/c/website/+/366376
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
2021-11-23 03:31:47 +00:00
Russ Cox c01d555894 talks: serve go.dev/talks for talks.golang.org content
This is the last user-facing golang.org domain.
Now everything is on go.dev.

Change-Id: I8d9f4b7609a019f077848825cbd417d38058a5ac
Reviewed-on: https://go-review.googlesource.com/c/website/+/365494
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-11-22 20:36:15 +00:00
Russ Cox 91661c0642 internal/talks: copy golang.org/x/tools/cmd/present/dir.go
This is an almost unmodified copy of
golang.org/x/tools/cmd/present/dir.go
as of 43b469a (Nov 17 2021).

The only modification is adding a '//go:build ignore' line.

Checking this file in will let the next CL show the diffs
for adaptation to x/website.

Change-Id: I808886338df44878b728be096b91b6aa8179be56
Reviewed-on: https://go-review.googlesource.com/c/website/+/365134
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-11-22 20:36:08 +00:00
Sean Liao c5047a94bc internal/blog: fix atom feed self link
Fixes golang/go#49595

Change-Id: Ie28221bf3dfe804ce3124040b15569a63ace56fa
Reviewed-on: https://go-review.googlesource.com/c/website/+/364275
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-11-22 17:28:07 +00:00
Russ Cox e77adb1f30 tour: serve from cmd/golangorg as go.dev/tour
tour.golang.org is the last independent server in this repository
and almost the last golang.org domain with user-facing content.
(talks.golang.org remains.)

We need to keep golang.org/x/website/tour as a runnable binary,
but move the logic into internal/tour so it can be used from both
the tour binary and cmd/golangorg.

After this is deployed, we will need to delete the current tour app
from the golang-org project, and then requests for tour.golang.org
will default to the main server (cmd/golangorg).

This will make the tour available in China for the first time,
at golang.google.cn/tour.

Change-Id: I0f025d8ae89e12489d26bb3bc380a833eeb57bcc
Reviewed-on: https://go-review.googlesource.com/c/website/+/365100
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-11-22 16:43:07 +00:00
Russ Cox ab4f479b5c all: make golang.org and go.dev links relative
Now that there is one site, update all golang.org links to go.dev.
But for any links being served from go.dev, make host-relative,
so that when serving golang.google.cn, we stay on that host as
much as possible.

Change-Id: Id6e1303059b5522846a64202bc1a8b81dc3854cd
Reviewed-on: https://go-review.googlesource.com/c/website/+/365095
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-11-22 16:42:44 +00:00
Russ Cox cecdbb6e8e website: merge golang.org → go.dev
As described in https://go.dev/blog/tidy-web,
redirect golang.org to go.dev.
The golang.org home page is retired -
go.dev now has all the same info and links,
and it doesn't have ten-year-old videos of me.
All the other golang.org pages are now served
directly from go.dev, styled differently but with
the same content.

A followup CL will merge the _content directories.

Change-Id: Ib7f3d951842c021280981f9b926c4943f4d9cb52
Reviewed-on: https://go-review.googlesource.com/c/website/+/364859
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-11-22 16:40:01 +00:00
Russ Cox 961523a997 go.dev: add /play
This is a replacement for the UI of play.golang.org,
although it still uses play.golang.org as the backend
and probably always will, to keep the playground backend
deployment separate from the rest of the web site.

Change-Id: Ia39000e80368b98d9cc273d246f2c83670fbacc4
Reviewed-on: https://go-review.googlesource.com/c/website/+/364815
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-11-22 16:40:00 +00:00
Russ Cox b457dda264 internal/short: allow registering on a specific host
This makes internal/short like most of the other registrations.

Preparation for the golang.org -> go.dev move.

Change-Id: I55039d6d668ac38ddb8e2412b7ab7ff44db8dd97
Reviewed-on: https://go-review.googlesource.com/c/website/+/362497
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-11-17 17:48:03 +00:00
Russ Cox 4209fd81f5 internal/dl: make download page testable offline
Added a copy of the datastore content for use offline.
This lets us test download page rendering locally.

Preparation for the golang.org -> go.dev move.

Change-Id: Ic0c49a96329eed4310dd91e03c4ea832189ef65a
Reviewed-on: https://go-review.googlesource.com/c/website/+/362496
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-11-17 17:47:58 +00:00
Russ Cox 70e627117c cmd/golangorg: fix display of text files
Text files were being displayed raw, e.g.
https://golang.org/src/math/sin.go.
Fix that.

Change-Id: I09dec1d675ca950bf3750c38585cf3995a570134
Reviewed-on: https://go-review.googlesource.com/c/website/+/361206
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-11-06 12:24:47 +00:00
Than McIntosh c863a5098b internal/history: document Go 1.17.3 and Go 1.16.10
Change-Id: Ice3c14820da241b24394bc38ab7b30fad4de656d
Reviewed-on: https://go-review.googlesource.com/c/website/+/361201
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Website-Publish: DO NOT USE <dmitshur@google.com>
2021-11-04 15:32:36 +00:00
Michael Anthony Knyszek 3b9afa944d internal/history: document Go 1.17.2 and Go 1.16.9
Change-Id: I555f2e1c396ceffc7819cf423226f556bb4af5f5
Reviewed-on: https://go-review.googlesource.com/c/website/+/354570
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Website-Publish: DO NOT USE <dmitshur@google.com>
2021-10-07 22:23:32 +00:00
Than McIntosh bd548c676d internal/history: document Go 1.17.1 and Go 1.16.8
Change-Id: I64708dacaed4afc24332fb79a3ad3b4cf586514e
Reviewed-on: https://go-review.googlesource.com/c/website/+/348809
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Website-Publish: DO NOT USE <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-09 18:03:44 +00:00
Dmitri Shuralyov 3bee3041b4 internal/dl: highlight Windows ARM64 installer
The windows/arm64 port is new to Go 1.17 and one of its key features.
Highlight the Windows ARM64 installer, just like the Windows AMD64
installer is highlighted. (Keep the zip archives and 386 installer
not highlighted.)

For golang/go#36439.

Change-Id: Ib57e80465d0ca090d165e14e3c4afdb2efca0c11
Reviewed-on: https://go-review.googlesource.com/c/website/+/344070
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2021-08-23 18:13:21 +00:00
Dmitri Shuralyov 0c7c710b59 internal/dl: change GOARCH=arm64 pretty string ARMv8 → ARM64
ARM64 makes for a better pretty string for the "arm64" architecture.
It's more clear that it's 64-bit, and it's closer to what we almost
always say.

Thanks to Cherry for making this suggestion.

For golang/go#38485.
For golang/go#36439.

Change-Id: I89c175ea2bafce6f191ae797ed982c73962ee5da
Reviewed-on: https://go-review.googlesource.com/c/website/+/344069
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2021-08-23 18:12:57 +00:00
Russ Cox 509175483b cmd/golangorg: use embedded content on App Engine
Change-Id: If211bdb2ba60fbb799cb4dfe67fd066094afc40f
Reviewed-on: https://go-review.googlesource.com/c/website/+/343936
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-23 15:30:36 +00:00
Russ Cox a3cb3101ad all: delete unmodified Go 1.16 backports
Go 1.16 is available on App Engine now, so use it.

Also, Go 1.17 has been released, meaning
we don't need to keep Go 1.15 builders working.

Delete all the Go 1.16 backports except the template packages,
which contain modifications we need.

Change-Id: I4612441a1484ce9272a22268da73d67f7624309b
Reviewed-on: https://go-review.googlesource.com/c/website/+/343935
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-23 15:30:31 +00:00
Dmitri Shuralyov 06c346b9b6 internal/dl: update minimum macOS version to 10.13
Featured downloads on golang.org/dl use the latest Go release, which
is now Go 1.17. Per golang.org/doc/go1.17#darwin, Go 1.17 requires
macOS 10.13 High Sierra or later.

For golang/go#23011.
Fixes golang/go#47867.

Change-Id: I868d118f073977c74429d70ae9ab7c526d098cf7
Reviewed-on: https://go-review.googlesource.com/c/website/+/344071
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
2021-08-23 14:12:00 +00:00
Russ Cox 45603b6afa internal/redirect: gofmt
Change-Id: If4bbcc78c0c1aa35531ceacd43399f52bc1a0174
Reviewed-on: https://go-review.googlesource.com/c/website/+/343938
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-20 20:20:31 +00:00
Russ Cox a32a1a4724 cmd/golangorg: fix blog feed on home page
New jsonp handler was buggy,
and unclear whether redirects are followed.

Change-Id: Ib1e85aa879018cb8e0da664ec47b10dfcda049c5
Reviewed-on: https://go-review.googlesource.com/c/website/+/343410
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
2021-08-18 23:01:08 +00:00
Russ Cox b110cf7979 cmd/golangorg: add blog to valid hosts
Also hard-code EnforceHosts behavior.
It was only optional to enable the old tip.golang.org server,
but that code is dead or at least no longer pointed to by DNS.

Hard-coding the EnforceHosts behavior makes for fewer
prod-only test failures.

Change-Id: Ib958b3f088c8175e67708efcd07426b9628b207b
Reviewed-on: https://go-review.googlesource.com/c/website/+/343311
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-18 20:07:38 +00:00
Russ Cox 6c6d3e7c40 cmd/golangorg: move blog from blog.golang.org to go.dev/blog
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-18 19:48:35 +00:00
Russ Cox 68b6eba5d5 cmd/golangorg: fix regexp match with ^ and $
Also fix doc/articles/wiki code file references.

Fixes golang/go#47759.

Change-Id: Idd0cce627f594898c805269ae7cd0e0f980aec8f
Reviewed-on: https://go-review.googlesource.com/c/website/+/343289
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>
Website-Publish: Russ Cox <rsc@golang.org>
2021-08-18 16:21:07 +00:00
Russ Cox 2bccad4564 cmd/golangorg: fix golang.google.cn/dl
Fixes golang/go#47750.

Change-Id: I1816df0dbd629705118b6f5b23c264efab73b04b
Reviewed-on: https://go-review.googlesource.com/c/website/+/343009
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>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
2021-08-17 18:22:03 +00:00
Russ Cox ef7fed48ec internal/web: merge with go.dev/cmd/internal/site
internal/web was the framework left serving golang.org.
go.dev/cmd/internal/site was the framework serving go.dev.
This CL merges the two into a coherent, simple site serving
framework that works for both sites, a step toward merging
the sites themselves.

The CL is difficult to break up, so it's a bit larger than would be ideal.
The best place to start is the doc comment in internal/web/site.go
and then the other changes in that directory.
The rest of the CL is just minor adjustments to the repo to match.

Change-Id: I927dea29396104a817bd81b6bf25fa43f996968f
Reviewed-on: https://go-review.googlesource.com/c/website/+/339403
Trust: Russ Cox <rsc@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-17 13:59:37 +00:00
Russ Cox f8f1822414 internal/web: move SrcBreadcrumb SrcPkgLink, invoke into templates
There's no real need for these to be written in Go.

Change-Id: Ifb3ebc99a06bb9670a39238a1ddf370c2dcd6a22
Reviewed-on: https://go-review.googlesource.com/c/website/+/339402
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-17 13:59:33 +00:00
Russ Cox 5a3d51791d internal/tmplfunc: mv go.dev/cmd/internal/tmplfunc up a few levels
Make internal/tmplfunc available to the whole module,
as one more step toward merging internal/web and go.dev/cmd/internal/site.

Also bring in rsc.io/tmplfunc support for fs.FS.

Change-Id: I65486c32136ec500de172b8297d0605fef9d5c83
Reviewed-on: https://go-review.googlesource.com/c/website/+/339401
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-17 13:59:29 +00:00
Michael Anthony Knyszek cb7929b9fd internal/history: add Go 1.17
Change-Id: Idbb89a88af787472e48bbc3f437462842156af3f
Reviewed-on: https://go-review.googlesource.com/c/website/+/342483
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Website-Publish: DO NOT USE <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-08-16 18:33:20 +00:00
Russ Cox f4281e3dec cmd/golangorg: add ability to serve tip.golang.org directly from Gerrit
Currently, tip.golang.org is deployed by a background loop
that fetches the latest Go and website repos every few minutes
and then does a deploy to a whole separate app.
Because this setup is different from the main app deploy,
it often gets broken by changes in the way the main app runs.

This CL removes the recurring source of breakage by making
the main app capable of serving tip.golang.org directly.
It does this by watching the main Go repo itself and downloading
a new copy of the file tree whenever there are changes.

The website repo is not watched: new changes to the website
repo already result in redeploys of the entire app when appropriate.

This CL does not actually enable the new tip.golang.org code.
A followup CL will do that, for easier rollback.

Change-Id: I015368c614579c90fa72a6699f6ab76202f87e7e
Reviewed-on: https://go-review.googlesource.com/c/website/+/328214
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-08-12 13:25:58 +00:00
Russ Cox f524297668 internal/gitfs: add git-backed FS implementation
This code is new and not anywhere else at the moment.
It is for a new implementation of tip.golang.org.

Change-Id: I176630816587387c08cdc53993889a5009612565
Reviewed-on: https://go-review.googlesource.com/c/website/+/328213
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-08-12 13:25:57 +00:00
Alexander Rakoczy fb30ab730d internal/history: document Go 1.16.7 and Go 1.15.15
Change-Id: I7650239269944f3f48876cb57174ed9ffc63c1d1
Reviewed-on: https://go-review.googlesource.com/c/website/+/340169
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Website-Publish: DO NOT USE <dmitshur@google.com>
2021-08-05 17:00:27 +00:00
Russ Cox 39c67f0653 internal/pkgdoc: take on doc-specific parts of internal/web
Not all the package docs-specific parts of the server moved into
internal/pkgdoc before. Finish the job. Now the API for pkgdoc
is like the API for codewalk: just a NewServer that returns a handler.

Speaking of codewalk, unexport the Server type to match the
trimmed-down pkgdoc.

Change-Id: I19ba7351d55fb5d23d551a0296bb89d8abac6e9b
Reviewed-on: https://go-review.googlesource.com/c/website/+/328212
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-07-23 19:28:56 +00:00
Carson Hoffman 7b37f32c8b internal/web: stop double-escaping of code in non-playground examples
CL 317655 introduced an issue causing non-playground code examples
to be double-escaped, causing HTML escape sequences and elements
to appear in the code, such as the examples in crypto/rsa,
as reported in golang/go#46839. This change treats the code as
template.HTML rather than string after running through (*Page).Node
(which formats the code as HTML) and doing some basic transformations,
preventing this double-escaping from occurring.

Fixes golang/go#46839

Change-Id: Id226147eb51219bd5e2db61e959519258e39a298
GitHub-Last-Rev: 81f8dc5e87
GitHub-Pull-Request: golang/website#73
Reviewed-on: https://go-review.googlesource.com/c/website/+/332889
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
2021-07-19 21:36:17 +00:00
Dmitri Shuralyov 8557135a89 internal/history: document Go 1.16.6 and Go 1.15.14
Change-Id: I2a585536147bd030f1bb333c05ffa45ef656bfcc
Reviewed-on: https://go-review.googlesource.com/c/website/+/334069
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-07-12 22:28:50 +00:00
Russ Cox aa5eb5fcb4 internal/web: redirect golang.org/pkg/... to pkg.go.dev/...
This reduces the number of documentation sites we have to one.
Except in China, where we have to keep serving on the one domain
golang.google.cn - there is no pkg.go.dev in China.
And unless people opt out with ?m=old.

For golang/go#44356.

Change-Id: I2a5b788ac861ce37f356287413468497d184fc09
Reviewed-on: https://go-review.googlesource.com/c/website/+/327849
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-12 19:03:25 +00:00
Than McIntosh 6a50fde3fa internal/dl: add thanm to validUser
Change-Id: Ic87f3bf158b573a9773e999d79860fba58f2a92c
Reviewed-on: https://go-review.googlesource.com/c/website/+/332069
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-01 13:29:39 +00:00
Russ Cox a430a3f526 internal/web: pre-expand tabs in markdown
Goldmark has a bug that causes crashes in inputs
containing mixed spaces and tabs. Avoid it by removing tabs.

Change-Id: I4c678fce6c68bf0d448ed0b75a2ac12a42891ec6
Reviewed-on: https://go-review.googlesource.com/c/website/+/331349
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Steve Traut <straut@google.com>
2021-06-28 13:50:53 +00:00
Russ Cox 5f5f230b60 all: promote new app deployments only after they become ready
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-23 19:06:38 +00:00
Russ Cox 30658dff6b cmd/golangorg: factor out main handler setup
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-17 16:55:37 +00:00
Russ Cox fdd9055814 cmd/golangorg: deduplicate testdata/live.txt and testdata/web.txt
These are duplicates for no particularly good reason anymore.
Move the general tests into testdata/web.txt, leaving in live.txt
only the tests that cannot work except in production.

Change-Id: Ia8b4271a9cce78814ac57c7b4a462383e77ee3d5
Reviewed-on: https://go-review.googlesource.com/c/website/+/328010
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-17 16:18:31 +00:00
Russ Cox e0d934b436 cmd/golangorg: simplify, run on App Engine Standard, not Flex
This app has been through a lot of evolution and has accumulated
a lot of cruft in the way it is deployed. We can simplify deployment
down to a short Cloud Build script and go back to regular App Engine
for execution.

Also remove the prod-vs-local distinction and the build tag complexity.

App Engine Flex doesn't let us have extant versions without at least
a couple dedicated VMs, and then it also imposes a limit of 20 VMs,
which makes it unsuitable for continuous deployment, where we can
rack up many versions in a short amount of time. Going back to
App Engine Standard is a better fit, since versions that aren't getting
traffic scale down to zero.

Using App Engine Standard also matches blog and go.dev,
which will help with the eventual merging of all these servers.

Change-Id: I35167b569327ad253b9d367d747072a269205b20
Reviewed-on: https://go-review.googlesource.com/c/website/+/323892
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-16 18:19:59 +00:00
Russ Cox d831351689 all: make compatible with Go 1.15
With the help of the backported libraries introduced in the previous CL,
we can make the whole cmd/golangorg site run on Go 1.15 again.
This will let us use App Engine standard in advance of the release
of Go 1.16 on App Engine.

Change-Id: I9d1612de6f366e0774919aa6a94af14aafb248f5
Reviewed-on: https://go-review.googlesource.com/c/website/+/323891
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-15 02:35:50 +00:00
Russ Cox 35beb4cf86 internal/backport: add backports of current Go dev template, fs packages
This will let us use these APIs on App Engine before Go 1.16 is available.
The only thing we can't backport from Go 1.16 is embed, so that has to
be build-tagged off still, but we don't really need embed on App Engine.

This will let us move golang.org off App Engine Flex onto regular App Engine,
which will greatly simplify deployment and make it possible to do automatic
deployments.

When App Engine adds Go 1.16 support, most of this can go away.
(The template packages will need to stay, as go.dev will need some
Go 1.17 bug fixes from them.)

Change-Id: I16ee64862a43f591a31fae04caf4caa0fdb5af62
Reviewed-on: https://go-review.googlesource.com/c/website/+/323890
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-15 02:35:47 +00:00
Russ Cox e5882a3721 internal/webtest: add package for testing web servers
This package provides a way to write simple script-based tests of
web server behaviors, instead of reinventing the logic in every test,
as we too often do.

See the doc comment in webtest.go for more details.

Change-Id: Ie1af4f1def488a7520dce46c242643aec15a2fcf
Reviewed-on: https://go-review.googlesource.com/c/website/+/321074
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-15 02:12:39 +00:00
Russ Cox de60b61b0e cmd/golangorg: split out internal/codewalk [generated]
This code is not likely to ever change, so it's nice to stash elsewhere.

CL generated by the script below.

[git-generate]
cd cmd/golangorg
rf '
	mv codewalk.go golang.org/x/website/internal/codewalk
'
cd ../../internal/codewalk
rf '
	mv CodewalkServer Server
	mv NewCodewalkServer NewServer
	mv Codewalk codewalk
	mv Codestep codestep
'

Change-Id: If16a7dc9214a8d44ce42bc8e7e6ccd502b718c0e
Reviewed-on: https://go-review.googlesource.com/c/website/+/317661
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-14 17:41:40 +00:00
Russ Cox 5ee419f2ea all: remove toFS usage
The toFS calls were a stop-gap to convert from old code that wasn't
strict about path forms to the io/fs routines that are more strict.

Arrange to pass io/fs-compatible paths everywhere and remove toFS.

Change-Id: Id69c0f23074ebd3a6dfef2255b2f8185ad1d1249
Reviewed-on: https://go-review.googlesource.com/c/website/+/317659
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-14 17:41:38 +00:00
Russ Cox 4b5486d0e5 internal/dl: move template to lib/godoc
This completes an old TODO and uses the standard site frame
for the download page instead of having a separate copy.

Change-Id: Id647a6bb03d563b007b16cab51f40083d071c944
Reviewed-on: https://go-review.googlesource.com/c/website/+/317658
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-14 17:41:36 +00:00
Russ Cox 117627b3c2 internal/godoc: refactor into internal/web [generated]
What's left of internal/godoc is mainly a simple web server
for static content (plus the package docs provided by internal/pkgdoc)
and bears little resemblance to the original godoc.

Revamp the API and retire the name, moving to internal/web.

CL generated by the script below.

[git-generate]
cd internal/godoc
mv util.go istext.go
mv godoc_test.go template_test.go
mv server_test.go site_test.go

rf '
	mv TabWidth tabWidth
	mv IsText isText
	mv TabSpacer tabSpacer

	mv Presentation Site
	mv NewPresentation NewSite
	mv writerCapturesErr writeErrorSaver
	rm marshalJSON
	mv redirect maybeRedirect
	mv redirectFile maybeRedirectFile
	mv Site.serveText Site.serveRawText
	mv Site.serveTextFile Site.serveText
	mv Site.serveDirectory Site.serveDir
	mv Site.initFuncMap Site.initDocFuncs

	mv \
		toFS \
		Site \
		NewSite \
		Site.ServeError \
		Site.ServeHTTP \
		Site.ServePage \
		Page \
		Site.fullPage \
		Page.Invoke \
		writeErrorSaver \
		writeErrorSaver.Write \
		applyTemplateToResponseWriter \
		Site.serveFile \
		maybeRedirect \
		maybeRedirectFile \
		doctype \
		Site.serveHTML \
		Site.serveDir \
		Site.serveText \
		selRx \
		rangeSelection \
		Site.serveRawText \
		Site.googleCN \
		site.go

	mv example_nameFunc example_name
	mv example_suffixFunc example_suffix
	mv srcPosLinkFunc srcPosLink

	mv \
		siteFuncs \
		example_name \
		example_suffix \
		srcToPkg \
		Page.SrcPkgLink \
		Page.SrcBreadcrumb \
		Page.SrcPosLink \
		srcPosLink \
		sitefuncs.go

	mv \
		docServer \
		docServer.ServeHTTP \
		Page.ModeQuery \
		pkgdoc.go

	mv metaJSON fileJSON
	mv extractMetadata parseFile
	mv \
		file \
		fileJSON \
		join \
		open \
		jsonStart \
		parseFile \
		file.go

	mv \
		Site.initDocFuncs \
		Site.code \
		Site.contents \
		stringFor \
		Site.oneLine \
		Site.multipleLines \
		parseArg \
		match \
		docfuncs.go

	mv Site.ServeError.p Site.ServeError.s
	mv Site.ServeHTTP.p Site.ServeHTTP.s
	mv Site.ServePage.p Site.ServePage.s
	mv Site.code.p Site.code.s
	mv Site.contents.p Site.contents.s
	mv Site.fullPage.p Site.fullPage.s
	mv Site.googleCN.p Site.googleCN.s
	mv Site.initDocFuncs.p Site.initDocFuncs.s
	mv Site.multipleLines.p Site.multipleLines.s
	mv Site.oneLine.p Site.oneLine.s
	mv Site.serveDir.p Site.serveDir.s
	mv Site.serveFile.p Site.serveFile.s
	mv Site.serveHTML.p Site.serveHTML.s
	mv Site.serveRawText.p Site.serveRawText.s
	mv Site.serveText.p Site.serveText.s
	mv Site.writeNode.p Site.writeNode.s

	mv Page.pres Page.site

	mv astfuncs.go docfuncs.go examplefuncs.go \
		file.go istext.go markdown.go pkgdoc.go \
		site.go site_test.go sitefuncs.go \
		tab.go template_test.go \
		golang.org/x/website/internal/web
'
rm godoc.go meta.go page.go pres.go server.go template.go

cd ../../cmd/golangorg
rf '
	mv pres site
'

Change-Id: Ic03a2dbe14f74c60bd6a5a86ba4d3f36d8c5bea8
Reviewed-on: https://go-review.googlesource.com/c/website/+/317656
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-14 17:41:29 +00:00
Russ Cox 4c9e549253 internal/godoc: clean up use of templates
- convert from text/template to html/template
- use proper template set
- always pass *godoc.Page to templates, with custom value in .Data
- move stateful site template functions to methods on *godoc.Page
- unexport Presentation.ServeFile: ServeHTTP is good enough
- reorder api.DB.Func args to match source order (pkg first)
- rename lib/godoc/godoc.html to lib/godoc/site.html
  (lib/godoc itself must stay lib/godoc because of links to other content it holds).

Change-Id: I873f17db20107fdab11d276932e6d847a6081015
Reviewed-on: https://go-review.googlesource.com/c/website/+/317655
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-14 17:41:27 +00:00