“go get” command is the standard way of downloading and installing packages and related dependencies.
The snippet above basically tells the compiler to import the crypto package available at the github.com/mattetti/goRailsYourself/crypto path. It doesn’t mean that the compiler will automatically pull down the repository, so where does it find the code?
You need to pull down the code yourself. The easiest way is to use the go get command provided by Go.
go get github.com/mattetti/goRailsYourself/crypto
This command will pull down the code and put it in your Go path. When installing Go, we set the GOPATH environment variable and that is what’s used to store binaries and libraries. That’s also where you should store your code (your workspace).
$ ls $GOPATH
bin pkg src
The bin folder will contain the Go compiled binaries. You should probably add the bin path to your system path.
The pkg folder contains the compiled versions of the available libraries so the compiler can link against them without recompiling them.
Finally the src folder contains all the Go source code organized by import path:
$ ls $GOPATH/src
bitbucket.org code.google.com github.com launchpad.net
$ ls $GOPATH/src/github.com/mattetti
goblin goRailsYourself jet
When starting a new program or library, it is recommended to do so inside the src folder, using a fully qualified path (for instance: github.com/<your username>/<project name>)
Reference: Command go How does “go get” command know which files should be downloaded? https://github.com/NanXiao/golang-101-hacks http://www.golangbootcamp.com/book/basics