tour: look for content in module cache, not GOROOT/misc/tour

Tour content hasn't been available in GOROOT since Go 1.12¹, so stop
looking for it there.

A more useful fallback place to find tour content is the module cache.
When the is in the build list, it will be found via
build.Import. It will not be found, however, when the tour binary is
run outside of a module. This situation is more common as of Go 1.16,
since the default GO111MODULE value changed to on². If the version of
the tour binary is known, access the content for that version from the
module cache.

In the future, this complex and imperfect machinery will be replaced
with simply embedding the needed files in the binary. We can't do that
quite yet (not without duplicating a lot of code) because Go 1.15 is
supported, and because Go 1.14 is used for deployment.

It's not neccessary to provide a custom socket.Environ (which served
to provide a custom GOPATH value pointing inside GOROOT; that path
is being removed here). Delete it along with some other unused code.


Fixes golang/go#44243.

Change-Id: Ia239700170b8614d21cafe9617b51dddf3e337d5
Run-TryBot: Dmitri Shuralyov <>
TryBot-Result: Go Bot <>
Trust: Dmitri Shuralyov <>
Reviewed-by: Russ Cox <>
3 files changed
tree: 287aca5c78ac73f85c0037abbd176ac6d752ba4d
  1. .gcloudignore
  7. TODO
  9. app.yaml
  10. appengine.go
  11. codereview.cfg
  12. content/
  13. fmt.go
  14. go.mod
  15. go.sum
  16. gotour/
  17. local.go
  18. pic/
  19. reader/
  20. solutions/
  21. static/
  22. template/
  23. tools/
  24. tour.go
  25. tree/
  26. wc/

Go Tour

Go Reference

A Tour of Go is an introduction to the Go programming language. Visit to start the tour.


To install the tour from source, first install Go and then run:

$ go get

This will place a tour binary in your workspace's bin directory. The tour program can be run offline.


Contributions should follow the same procedure as for the Go project:

To run the tour server locally:

go run .

Your browser should now open. If not, please visit http://localhost:3999/.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see

The issue tracker for the tour's code is located at Prefix your issue with “x/tour:” in the subject line, so it is easy to find.

Issues with the tour's content itself should be reported in the issue tracker at


  1. To deploy, run:

    GO111MODULE=on gcloud --project=golang-org app deploy --no-promote app.yaml

    This will create a new version, which can be viewed within the golang-org GCP project.

  2. Check that the deployed version looks OK (click the version link in GCP).

  3. If all is well, click “Migrate Traffic” to move 100% of the traffic to the new version.

  4. You're done.


Unless otherwise noted, the go-tour source files are distributed under the BSD-style license found in the LICENSE file.