Emacs, scripting and anything text oriented.

Installing go toolchain

Kaushal Modi

“Installing” go is simply extracting its release archive, putting it somewhere in you $HOME and pointing GOROOT and PATH env vars to it.

Table of Contents

<2018-05-17 Thu>
Add “Updating go” section.

There are two reasons why I suggest installing go to anyone, 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 should work 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 extract it to ${HOME}/go/1.
  3. Create a directory where you would want to install the go packages.

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

    setenv GOROOT ${HOME}/go # 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 😁

Updating go #

  1. Delete the existing $GOROOT directory (not GOPATH!)

    rm -rf ~/go   # as that is my GOROOT
  2. Download the tar.gz for the latest linux-amd64 binaries.

  3. Extract it to the same $GOROOT (~/go in my case).

  1. I prefer to not add the version number to my go installation folder. That way, when I want to update it, I simply rm -rf it and put in the new version.. and I don’t need to update GOROOT or PATH. [return]
  2. You can refer to these official go references [ 1 ], [ 2 ] for further information on these variables. [return]

If you have written a response to this, enter your response post's URL below.

Or, you can send a "comment" webmention (it's OK if you don't know what that means). When asked about your website on an IndieAuth login screen, simply type https://commentpara.de.

Markdown Support**bold**, _italics_, ~~strikethrough~~, [descr](link), `monospace`, ```LANG\nline1\nline2\n``` (Yep, multi-line code blocks too, with syntax highlighting!), auto-hyperlinking.

Webmentions #

Mentioned by Kaushal Modi on Wed Mar 28, 2018 02:32 EDT
Installing bleeding edge Hugo + Goorgeous
—Published on Tue Mar 7, 2017

Update (2017/06/16)

Updated the github source references as per the changes in hugo v0.231. Also made the shell script ShellCheck-passing! 🙌 §

You already got go installed, and that’s why are you reading it.

If not – Go! Install it!

So.. …

Comment by Sam Ask on Tue Mar 7, 2017 12:09 EST

Thank you for this post.
Would you consider writing a tutorial on how to compile Hugo with latest goorgeous?github.com/chaseadamsio/goo...

Comment by Kaushal Modi on Wed Mar 8, 2017 00:01 EST
Replying to comment by Sam Ask: "Thank you for this post. Would you …"

Sure! Check out Installing bleeding edge Hugo + Goorgeous :)

Comment by Sam Ask on Wed Mar 8, 2017 12:59 EST
Replying to comment by Kaushal Modi: "Sure! Check out Installing bleeding …"

Wow, so fast. Thank you, this is precious.