doujia6433 2017-10-21 06:06
浏览 372
已采纳

Go:运行从github存储库派生的Go项目时,“不允许使用内部软件包”

I'm getting used to Go, and trying to understand how it works.

So I'm trying to run the test code from my repository zoonoo/go-ethereum, forked from the original repository ethereum/go-ethereum.

When I run go test . under the eth directory, I get the following error :

eth/api.go:37:2: use of internal package not allowed

37th line of eth/api.go is as follows : "github.com/ethereum/go-ethereum/internal/ethapi"

Does this mean when you fork a go repository, you have to change the path of all dependencies within the code to run the code?
Does Go package system support repository fork at all?

  • 写回答

2条回答 默认 最新

  • dongxing7318 2017-10-21 06:31
    关注

    As illustrated in another Go project:

    Cloning a fork

    If you wish to work with fork of InfluxDB, your own fork for example, you must still follow the directory structure above. But instead of cloning the main repo, instead clone your fork. Follow the steps below to work with a fork:

    export GOPATH=$HOME/gocodez
    mkdir -p $GOPATH/src/github.com/influxdb
    cd $GOPATH/src/github.com/influxdb
    git clone git@github.com:<username>/influxdb
    

    Retaining the directory structure $GOPATH/src/github.com/influxdb is necessary so that Go imports work correctly.

    Replace InfluxDB name/URL by your project, and the same idea applies.

    In your case, the GitHub fork is only there for you to push your contribution back to it, and to make Pull request from it.
    It won't serve as a source for go get to work, since the packages wouldn't match your GitHub for repo URL.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何实验stm32主通道和互补通道独立输出
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题