Say there's a Go app at github.com/supermighty/app
, which has a package a
that references b
.
If I fork that repository to github.com/ericlathrop/app
, now the local file $GOPATH/github.com/ericlathrop/app/a/something.go
still has the line
import ("github.com/supermighty/app/b")
so when I edit $GOPATH/github.com/ericlathrop/app/b/something.go
, my changes are never seen in a
because it's still using the original copy of b
!
The workaround is to symlink the original repository path to the fork's path:
rm -rf $GOPATH/github.com/supermighty/a
ln -s $GOPATH/github.com/ericlathrop/a $GOPATH/github.com/supermighty/a
This lets you avoid having to rewrite all the import URLs, and revert them when your pull request is merged in.
Nice solution. I linked it from this Google Doc
An alternative would be to use a tool to rewrite the imports on a branch that your team uses but does not send a pull request for. See https://groups.google.com/forum/#!topic/golang-nuts/ONs1vjIm9kg.