Now, let's see how Go code is organized. The GOPATH environment variable determines where the code resides. There are three subdirectories inside this:
- src contains all the source code.
- pkg contains compiled packages, which are divided into architecture/OS.
- bin contains the compiled binaries.
The path under the source folder corresponds to the name of the package ($GOPATH/src/my/package/name would be my/package/name).
The go get command makes it possible to fetch and compile packages using it. Go get calls to http://package_name?go-get=1 and if it finds the go-import meta tag, it uses this to fetch the package. The tag should contain the package name, the VCS that was used, and the repository URL, all separated by a space. Let's take a look at an example:
<meta name="go-import" content=...