As a result, I create my own GOPATH in the go project, which I want to keep isolated from my usual global $GOPATH .
I make a " b " script (in the project root folder) which:
- check if
src exists (in the project folder, here in ~/dev/git/project1 ): if it doesn't, - check if src / mypackage exists: if not, if creates a symbolic link
src/mypackage -> ~/dev/git/project1 . - called with an alias:
alias b='. ./b' alias b='. ./b'
So the same ' b ' (short for 'build') goes into ~/dev/git/project1/src/mypackage and does go install .
If you have a main package that will create a binary in ~/dev/git/project1/bin .
Thus, each of my projects remains autonomous, and is not lost in the sea of ββother go packages in my regular $GOPATH/src . I reserve the global $GOPATH for global projects, which helps me to develop in go: golang.org/x/tools/cmd/... , github.com/fzipp/gocyclo and the like (other linters).
In other words, I am not symbolically GOPATH .
I really associate my package inside my project with a local GOPATH (local to the specified project), but GOPATH itself is a fixed folder (again specific to my project), defined as usual, without any symbolic link)
And it is perfectly compatible with the provider folder for the source dependency provider.
alias b='. ./b' cd /path/to/my/project b: #!/bin/sh if [ ! -e src ]; then mkdir src ; fi if [ ! -e src/myproject ]; then ln -s /path/to/my/project src/myproject; fi cd src/myproject go install cd ../..
source share