I guess this question also relates a little bit to how you work with forks in Go
, which i don't think there exists a good solution for.
I am maintaining a old version of a product, so i often fix a bug in e.g. branch v0
, then i want to cherry pick the commit that fixes the bug into my master branch as well of course.
This kind of workflow is much better when you have access to git worktree
which allows me to have both master
and v0
checked out at the same time. My problem now is that my master branch
worktree would be e.g. checked out at ~/go/src/github.com/<company>/wt1_server
while my v0 branch
would be checked out at ~/go/src/github.com/company/server
.
Now my problem is that the imports of the master branch
is effectively importing code from the v0 branch
because all of the imports is pointing to that repo, instead of being relative.
Have anyone found a pretty fix to this?
EDIT: A tool like https://github.com/rogpeppe/govers can for example update the paths automatically. But that is going to make it impossible make any commits before reverting it back again. A very poor fix :)
EDIT 2: Looks like Go
modules could be a solution because of it's relative path to the module - i don't think i can have two modules with the same name installed at the same time though. But it could be a okay solution to run a go install .
when i have to work in some specific worktree