Multiple versions of go

Issue

I am trying to learn go-lng following the official docs here:
https://golang.org/doc/install

I am stuck on the step installing extra go versions. Apparently this line should install a different version of go and make the executable available in my $PATH but it’s not happening:

go get golang.org/dl/go1.10.7

Instead what I see is:

c.craig$ go get golang.org/dl/go1.10.7
c.craig$ go1.10.7 download
-bash: go1.10.7: command not found

Where am I going wrong? I’ve tried it with a space assuming this was just a typo in the docs but even that doesn’t work:

c.craig$ go get golang.org/dl/go1.10.7
c.craig$ go 1.10.7 download
go 1.10.7: unknown command

Solution

The binary is installed $HOME/go/bin (or more accurately the bin directory under the path you get from go env GOPATH). The go get command doesn’t update your $PATH, so you need to add the install directory to your $PATH yourself.

Answered By – Paul Hankin

Answer Checked By – Jay B. (GoLangFix Admin)

Leave a Reply

Your email address will not be published.