[x/tour] 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 golang.org/x/tour 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.

¹ https://golang.org/doc/go1.12#tour
² https://golang.org/doc/go1.16#modules

Fixes golang/go#44243.

Change-Id: Ia239700170b8614d21cafe9617b51dddf3e337d5
Reviewed-on: https://go-review.googlesource.com/c/tour/+/298529
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
X-Tour-Commit: b3263fcf7749f3600c8928d5f7d4e8a66a34b74f
3 files changed
tree: f131c2c7c43928d1e42e8d40f2906c3769e0f1c6
  1. tour/
  2. AUTHORS
  3. CONTRIBUTING.md
  4. CONTRIBUTORS
  5. LICENSE
  6. PATENTS
  7. README.md
README.md

Go Website

This repository holds the Go Website server code and content.

Download/Install

The easiest way to install is to run go get -u golang.org/x/website. You can also manually git clone the repository to $GOPATH/src/golang.org/x/website.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the time repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/website:” in the subject line, so it is easy to find.