tour: build snippets in module mode

We want to start building snippets in module mode rather than legacy
legacy GOPATH mode, to make tour work well when there's no tour code
in GOPATH/src and to be more future-proof. Building in module mode
means we need to specify a go.mod file to use for each snippet.

The tour web UI design predates the module mode and its go.mod files.
Txtar-based multi-file support was added to the playground (that the
tour uses for executing snippets) in, but the
web UI hasn't been updated to have first-class separate <textarea>
elements or tabs for editing multiple files.

For now, we can get by with providing a default go.mod file for all
tour snippets, since they only need some packages in the tour module.

Update to a newer version of the
package which includes multi-file snippet support added in CL 204237.

For golang/go#44243.

Change-Id: Ib05725c52fbe43658b2f22ac728b1e901e635824
Trust: Dmitri Shuralyov <>
Run-TryBot: Dmitri Shuralyov <>
TryBot-Result: Go Bot <>
Reviewed-by: Russ Cox <>
3 files changed
tree: c3d5051608c9fd17cc97ca4d3a0dd51403440d2f
  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.