Skip to content

Latest commit

 

History

History
29 lines (18 loc) · 1003 Bytes

README.md

File metadata and controls

29 lines (18 loc) · 1003 Bytes

This document is complementary to Getting Started showing how to configure Go and ensure it is on your path.

Intended audience includes developers and first-time users, including those who'd never used Go before.

$GOPATH and $PATH

There's of course a ton of tutorials and markdowns on the web, but the gist of it boils down to a single word: GOPATH. Namely, setting it up and exporting, e.g.:

$ mkdir /tmp/go/src /tmp/go/pkg /tmp/go/bin
$ export GOPATH=/tmp/go

Secondly, $GOPATH/bin must be in your $PATH. Something like:

$ export PATH=$GOPATH/bin:$PATH

The intuition behind that is very simple: $GOPATH defines location for:

  • Go sources
  • Go packages
  • Go binaries

Yes, all of the above, and respectively: $GOPATH/src, $GOPATH/pkg, and $GOPATH/bin.

And so, since you'd likely want to run binaries produced out of Go sources, you need to add the path, etc.