Skip to content

Commit 4edea0f

Browse files
committed
doc: mention 'go get golang.org/dl/...' in install
I needed Go 1.10 to debug and fix a test failure on that Go version in x/tools, but I forgot what the magic 'go get' command for this was. Googling "download specific golang version" and similar keywords showed no results, presumably because the golang.org/dl subrepo isn't prominently recommended nor documented anywhere. The most appropriate documentation page to add this to is doc/install, since it goes into some detail and is well indexed. We only need a short section to introduce the trick. The example does mention a specific version, Go 1.10.7, but I couldn't imagine a way to make it version-agnostic while still being clear on what the commands effectively do. Change-Id: I13158564d76d95caec412cdb35a50a4356df5863 Reviewed-on: https://go-review.googlesource.com/c/157457 Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Rob Pike <[email protected]>
1 parent cd06b2d commit 4edea0f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

doc/install.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,39 @@ <h2 id="testing">Test your installation</h2>
271271
</p>
272272

273273

274+
<h2 id="extra_versions">Installing extra Go versions</h2>
275+
276+
<p>
277+
It may be useful to have multiple Go versions installed on the same machine, for
278+
example, to ensure that a package's tests pass on multiple Go versions.
279+
Once you have one Go version installed, you can install another (such as 1.10.7)
280+
as follows:
281+
</p>
282+
283+
<pre>
284+
$ go get golang.org/dl/go1.10.7
285+
$ go1.10.7 download
286+
</pre>
287+
288+
<p>
289+
The newly downloaded version can be used like <code>go</code>:
290+
</p>
291+
292+
<pre>
293+
$ go1.10.7 version
294+
go version go1.10.7 linux/amd64
295+
</pre>
296+
297+
<p>
298+
All Go versions available via this method are listed on
299+
<a href="https://godoc.org/golang.org/dl#pkg-subdirectories">the download page</a>.
300+
You can find where each of these extra Go versions is installed by looking
301+
at its <code>GOROOT</code>; for example, <code>go1.10.7 env GOROOT</code>.
302+
To uninstall a downloaded version, just remove its <code>GOROOT</code> directory
303+
and the <code>goX.Y.Z</code> binary.
304+
</p>
305+
306+
274307
<h2 id="uninstall">Uninstalling Go</h2>
275308

276309
<p>

0 commit comments

Comments
 (0)