Go Setup Smarts

By pjain      Published July 29, 2019, 1:53 a.m. in blog Programming   

Go BPR, Setup

Setup Go toolchain (pkj did 1.6.2 on 5/22/16)

  1. Install go root package
  2. download osx pkg at https://golang.org/dl/
  3. just double click to run installer (just ~expands it to /usr/local/go tree)

    $ go version go version go1.9 darwin/amd64

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:

export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go

Setup Multiple Versions

It may be useful to have multiple Go versions installed on the same machine, for example, to ensure that a package's tests pass on multiple Go versions.

All Go versions available via this method are listed on the download page. You can find where each of these extra Go versions is installed by looking at its GOROOT; for example, go1.10.7 env GOROOT. To uninstall a downloaded version, just remove its GOROOT directory and the goX.Y.Z binary.

Once you have one Go version installed, you can install another (such as 1.10.7) as follows:

$ go get golang.org/dl/go1.10.7 $ go1.10.7 download The newly downloaded version can be used like go:

$ go1.10.7 version go version go1.10.7 linux/amd64

9z. Uninstalling Go

To remove an existing Go installation from your system delete the go directory, and remove the various go path variables etc from your .bash_profile


There are no comments yet

Add new comment

Similar posts

Go Sample Full Apps

Go Quickstart

Go Reference, Cheatsheet

Go Concurrency 101