I'm trying to understand how to work with Golang and forks. The situation is the following, I'm writing a library project
which depends on library github.com/other/some_dependency
, which isn't mine.
Because some_dependency
is missing some methods that I need, I fork it to github.com/me/some_dependency
. However, I can't just do go get github.com/me/some_dependency
, the library references itself so it breaks.
In this article they give a possible solution:
go get github.com/other/some_dependency
cd $GOPATH/src/github.com/other/some_dependency
git remote add fork git@github.com:me/some_dependency
git rebase fork/master
Now, this is hacky at best. There is no way from the code of the library to know that the dependency is coming from a different repo. Anyone doing go get
of my library wouldn't manage to make it work.
As dep is expected to be the official dependency manager. I've found how to fix the version:
dep ensure -add github.com/foo/bar@v1.0.0
But I cannot find how to set a different remote. Is is possible to do it? As an example, in Node.js with npm it is dead simple:
npm install git+https://git@github.com/visionmedia/express.git