Understand GOPATH
21 September 2014
GOPATH can also be called go workspace
the structure of GOPATH contain three folder, –src –pkg –bin where src is for source code, pkg is for dependence and bin is for binary file
a tipical structure of go project
bin/
streak # command executable
todo # command executable
pkg/
linux_amd64/
code.google.com/p/goauth2/
oauth.a # package object
github.com/nf/todo/
task.a # package object
src/
code.google.com/p/goauth2/
.hg/ # mercurial repository metadata
oauth/
oauth.go # package source
oauth_test.go # test source
github.com/nf/
streak/
.git/ # git repository metadata
oauth.go # command source
streak.go # command source
todo/
.git/ # git repository metadata
task/
task.go # package source
todo.go # command source
the command go install
, will build go executable and put it into bin
folder
and when you go get ...
, it will clone the project from github into src
folder of your workspace aka GOPATH
blog comments powered by Disqus