Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Use the symlinks, Luke.

My $GOPATH is in a standard place: $HOME/.local/share/go (aka $XDG_DATA_HOME/go) and all my projects (whatever language it is) live in $HOME/dev.

I use github for all my projects, so the public path for my go projects would be $GOPATH/src/github.com/rakoo/petproject. So all I have to do is

    $ cd $GOPATH/src/github.com/rakoo
    $ ln -s ~/dev/petproject petproject
and everything works flawlessly. I get to keep using my ~/dev dir for all my projects, and the Go environment is well defined and works as expected.

You do have to do this once for each project you start, but that should scale quite well.

TL;DR: Your projects don't need to be in $GOPATH; they only need to be accessible from $GOPATH



Ah hah! I wish I could give you more than just an upvote, as that's awesome, and I really wish I'd thought of it first. I'll give it a try, thanks very much!


That's neat!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: