在Go中使用分叉包导入 [英] Using forked package import in Go
问题描述
假设您在github.com/someone/repo
处有一个存储库,然后将其分叉到github.com/you/repo
.您要使用fork而不是主仓库,所以要做一个
Suppose you have a repository at github.com/someone/repo
and you fork it to github.com/you/repo
. You want to use your fork instead of the main repo, so you do a
go get github.com/you/repo
现在此仓库中的所有导入路径都将被破坏",这意味着,如果存储库中有多个通过绝对URL相互引用的包,则它们将引用源而不是派生.
Now all the import paths in this repo will be "broken", meaning, if there are multiple packages in the repository that reference each other via absolute URLs, they will reference the source, not the fork.
是否有更好的方法手动将其克隆到正确的路径?
Is there a better way as cloning it manually into the right path?
git clone git@github.com:you/repo.git $GOPATH/src/github.com/someone/repo
推荐答案
处理请求请求
- 将存储库
github.com/someone/repo
分叉到github.com/you/repo
- 下载原始代码:
go get github.com/someone/repo
- 在那里:
cd "$(go env GOPATH)/src"/github.com/someone/repo
- 启用上传到分叉:
git remote add myfork https://github.com/you/repo.git
- 将更改上传到仓库:
git push myfork
- fork a repository
github.com/someone/repo
togithub.com/you/repo
- download original code:
go get github.com/someone/repo
- be there:
cd "$(go env GOPATH)/src"/github.com/someone/repo
- enable uploading to your fork:
git remote add myfork https://github.com/you/repo.git
- upload your changes to your repo:
git push myfork
To handle pull requests
http://blog. campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html
https://github.com/golang/go/wiki/PackageManagementTools
这篇关于在Go中使用分叉包导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!