在Go中使用分叉包导入 [英] Using forked package import in Go

查看:83
本文介绍了在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
  • To handle pull requests

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆