Reputation: 266910
I want to start developing a go web service at the following path:
/dev/git/proj1/mygoservice/
/dev/git/proj1/railsapp/
If my go path is at:
~/go
How will this work? Should I create a symbolic link to my git repo?
I want to keep all my sub-projects grouped together under teh /dev/git/proj1 path.
Upvotes: 1
Views: 333
Reputation: 1323125
If you have to keep your sources in /dev/git/proj1
, then you would need indeed a symlink from your sources to the official GOPATH ~/go/src
(respecting a workspace structure).
And not the other way around, from ~/go/src
to your sources.
That is because go tools don't follow symlink, as commented by JimB
(issue 15507, issue 17451)
So:
cd /dev/git/proj1
mv mygoservice ~/go/mygoservice
ln -s ~/go/mygoservice
But if you need to push your git repo to a GitHub project, then it would be best to use the right folder structure in order for your Go project to be go gettable, as seen in "Import paths":
mkdir -p ~/go/src/github.com/<auser>
cd /dev/git/proj1
mv mygoservice~/goo/src/github.com/<auser>
ln -s ~/go/src/github.com/<auser>/proj1/mygoservice /dev/git/proj1/mygoservice
That way, you will use within your go sources the right import path based on "github.com/<auser>/mygoservice
"
Upvotes: 2