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

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条)

报告相同问题?

悬赏问题

  • ¥50 adb连接不到手机是怎么回事?
  • ¥15 vs2022无法联网
  • ¥15 TCP的客户端和服务器的互联
  • ¥15 VB.NET操作免驱摄像头
  • ¥15 笔记本上移动热点开关状态查询
  • ¥85 类鸟群Boids——仿真鸟群避障的相关问题
  • ¥15 CFEDEM自带算例错误,如何解决?
  • ¥15 有没有会使用flac3d软件的家人
  • ¥20 360摄像头无法解绑使用,请教解绑当前账号绑定问题,
  • ¥15 docker实践项目