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>
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>
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>
For golang/go#47397
Change-Id: I7046bddb17bdd7957603e16580e7c9bab4a8c05a
Reviewed-on: https://go-review.googlesource.com/c/website/+/339991
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Change-Id: Ie15dc10304d430d1fb3201931fc5c161581f79ea
Reviewed-on: https://go-review.googlesource.com/c/website/+/340209
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
As per the documentation: Google Cloud services such as Cloud Build and
Google Kubernetes Engine automatically check for cached images before
attempting to pull an image from Docker Hub.
Also: Only obtain cached images on mirror.gcr.io by configuring the
Docker daemon. A request to pull directly from mirror.gcr.io will fail
if a cached copy of the image does not exist.
Source: https://cloud.google.com/container-registry/docs/pulling-cached-images
Change-Id: I4320f97b016d928ea7431c56dd7486467f436a53
Reviewed-on: https://go-review.googlesource.com/c/website/+/340171
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Website-Publish: DO NOT USE <dmitshur@google.com>
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>
The updated designs for go.dev no longer contain package
search. Removing search from the header ahead of time to
simplify the process of making changes to search on
pkg.go.dev.
Change-Id: I49ee684641f7e80408a339ada28fe2727d549a91
Reviewed-on: https://go-review.googlesource.com/c/website/+/336909
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
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>
Change-Id: Ib2316795409776a9db2dd6293b76d7c0003ba7f4
Reviewed-on: https://go-review.googlesource.com/c/website/+/335690
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Steve Traut <straut@google.com>
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.
Fixesgolang/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>
Also update the list of behaviors controlled by the go directive for
Go 1.17.
Change-Id: Ie9eee13f0c43efd41f97d8d7c30a5ec354064776
Reviewed-on: https://go-review.googlesource.com/c/website/+/335141
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Steve Traut <straut@google.com>
On non-firefox browsers the search input is focussed
after pressing the / key to match the behavior of
pkg.go.dev.
Fixesgolang/go#42704
Change-Id: I81a804a9062f78997f3161ec86d1adcb8a911c92
Reviewed-on: https://go-review.googlesource.com/c/website/+/335669
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
As of CL 323897, the tour command and its static content are
contained in a module with a slightly different module path.
Update findRoot accordingly so it looks in the right place.
Updates golang/go#44243.
Change-Id: I5c979789440464ca3f9f99799bcc8e73db0769a3
Reviewed-on: https://go-review.googlesource.com/c/website/+/334969
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Since the golang/tour repository was emptied and the tour content
moved to x/website/tour, go-getting golang.org/x/tour no longer works.
This change updates the instructions to run the tour locally, both in
the tour welcome page and in the repository's README.
It also updates the pkg.go.dev badge link.
Fixesgolang/tour#1203
Change-Id: I1591e790ff3821dea4304f38a7ebc7867da585a6
Reviewed-on: https://go-review.googlesource.com/c/website/+/326330
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
For golang/go#36460
Change-Id: I36b3657103f069412b225356d011a19c1a10109e
Reviewed-on: https://go-review.googlesource.com/c/website/+/333629
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Change-Id: I8930b2e394c30334b99bb3e169e805f2025ec7d9
Reviewed-on: https://go-review.googlesource.com/c/website/+/324709
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
I plan to add a more in-depth troubleshooting guide at this URL.
For now, I just need to URL to work so that I can point to it in
the 'go' command in Go 1.17 (in CL 332573).
For golang/go#36460
Change-Id: I95f03f76519dfb196ed6c9c13003b2ad9becf6c9
Reviewed-on: https://go-review.googlesource.com/c/website/+/334389
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Steve Traut <straut@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
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>
The golang.org health check was failing the tip.golang.org tests
because the host enforcer was redirecting an unknown subdomain
to golang.org. Make tip a known subdomain to fix the tests, and
then restore them.
(The standard tip.golang.org setup disables the enforcer instead.)
Change-Id: Id15e7bcb3a704b7782e132c4303576f9d3e80cb0
Reviewed-on: https://go-review.googlesource.com/c/website/+/334112
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
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>
This change fixes a link from /doc/database/change-data
to /doc/database/querying.
Change-Id: I76b57d0df17b4ef65dc02afd0a1f33aeef262243
Reviewed-on: https://go-review.googlesource.com/c/website/+/332251
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Steve Traut <straut@google.com>
This adds a tutorial introducing how to build a RESTful web service
using Go and the Gin web framework.
This change includes:
- A RESTful web service tutorial:
- _content/doc/tutorial/web-service-gin.md
- Updates to index topics so that they list the new content.
- _content/doc/index.html
- _content/doc/tutorial/index.html
Change-Id: I137dcd884c4e38b4a2bebd733ec630f2d9bc3b95
Reviewed-on: https://go-review.googlesource.com/c/website/+/332349
Trust: Steve Traut <straut@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
This adds an introductory tutorial on accessing relational
databases, as well as a deeper dive data access guide
comprising nine topics.
This change includes:
- A data access tutorial:
- _content/doc/tutorial/database-access.md -- An introductory
data access tutorial.
- A data access guide:
- _content/doc/database/index.md -- An overview of data
access with Go.
- _content/doc/database/open-handle -- On opening a database handle.
- _content/doc/database/change-data -- On executing SQL statements
that don't return data
- _content/doc/database/querying -- On querying for data
- _content/doc/database/prepared-statements -- On using prepared
statements
- _content/doc/database/execute-transactions -- On executing
transactions
- _content/doc/database/cancel-operations -- On using Context to
support cancelling in-progress database operations
- _content/doc/database/manage-connections -- On customizing the
connection pool and using a reserved connection
- _content/doc/database/sql-injection -- On using function
parameters to avoid a SQL injection risk
- Updates to index topics so that they list the new content.
- _content/doc/index.html
- _content/doc/tutorial/index.html
Change-Id: Iab94d93e5d53e1379b22098c08d517b99cfa2c27
Reviewed-on: https://go-review.googlesource.com/c/website/+/331449
Reviewed-by: Russ Cox <rsc@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Steve Traut <straut@google.com>
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>
We already mentioned this fact elsewhere in the document, but the
"go.mod files" section is a likely starting point for someone trying
to figure out what happens when the file is missing. This adds some
prose and links there to point the reader to the appropriate sections.
Noticed via https://stackoverflow.com/q/67030123.
Change-Id: Ia7fe50a8b97b8cc1320778c318e5b3b0694d7c05
Reviewed-on: https://go-review.googlesource.com/c/website/+/331949
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
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>
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>
We already have one server handling multiple domains:
golang.org and golang.google.cn. As we make the server
handle more domains it is helpful to be able to get at each
of them in the testing server.
This CL changes the behavior on localhost or on an appspot.com domain
to pull the effective host name out of the first element of the path.
It also rewrites HTML responses to turn relative links like /doc to /<host>/doc
and to turn absolute links like https://golang.org/doc into /golang.org/doc.
Change-Id: I032b626f1c75deed61a9ae2d9562d6b177b2824a
Reviewed-on: https://go-review.googlesource.com/c/website/+/328013
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>
"-replace=foo.com=bar.com" triggers this bug in PowerShell:
https://github.com/PowerShell/PowerShell/issues/6291
The go command accepts "-replace foo.com=bar.com" just fine. Use that
instead.
Fixes#44924.
Change-Id: I854ea86282db425a2707c641b0500208b4869870
Reviewed-on: https://go-review.googlesource.com/c/website/+/330229
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Steve Traut <straut@google.com>
For golang/go#43684
Change-Id: Ic72fd0b6d1f4ff3262115e1cdaf028c315dc18f8
Reviewed-on: https://go-review.googlesource.com/c/website/+/329500
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
https://golang.org/misc/cgo/stdio/testdata/fib.go fails right now
because the http.FileServer wants to use Seek to find out the file size.
Make that work by introducing an FS wrapper that enables seeking
in an in-memory copy of the file content.
Fixesgolang/go#46809.
Change-Id: I353905310dc74594e54e0181dc821a97992b8da7
Reviewed-on: https://go-review.googlesource.com/c/website/+/329249
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Russ Cox <rsc@golang.org>
After the refactoring we use this now instead of repoRoot
in the call to NewHandler.
Once we have Go 1.16 this will all be simplified using //go:embed.
Also delete comment that I deleted locally in the previous CL
but then didn't upload before clicking Submit on the Gerrit web page.
Change-Id: Id6e122d39914c1059e97af6cd7e90049142dbe7f
Reviewed-on: https://go-review.googlesource.com/c/website/+/329010
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>
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>
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>
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>