A Scripter's Notes

Emacs, scripting and anything text oriented.

Installing go toolchain

There are 2 reasons why I suggest installing go to anymore, whether they are Go developers, or not (like me).

  1. You can then build amazing utilities like peco, hugo and noti.
  2. It’s easy!

Installing go

Below instructions are for installing go on a 64-bit GNU/Linux machine, and using tcsh shell. But similar steps can be applied for any other OS and shell.

  1. Download the tar.gz for the latest linux-amd64 binaries from https://golang.org/dl/.
  2. Extract it to some place in your $HOME. I extracted it to ${HOME}/go1.8/.
  3. Create a directory where you would want to install the go packages:

    mkdir -p ~/go.apps
  4. Set the following environment variables1, and also save them to your shell config:

    setenv GOROOT ${HOME}/go1.8 # go root
    setenv GOPATH ${HOME}/go.apps # for go applications
  5. Add the ${GOROOT}/bin and ${GOPATH}/bin directories to your $PATH.

Now you can install any go application!

For instance, noti is a nice little utility that triggers an alert (desktop popup, Pushbullet notification, etc.) when a process finishes. From its installation notes, you just run the below to install it:

go get -u github.com/variadico/noti/cmd/noti

Apart from the go applications I suggested here, go out and explore more – go get them :)

  1. You can refer to these official go references [1,2] for further information on these variables. [return]


comments powered by Disqus