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 C++扑克牌游戏的编程
  • ¥15 有人能看一下我宿舍管理系统的报修功能该怎么改啊?链表那里总是越界
  • ¥15 cs loadimage运行不了,easyx也下了,没有用
  • ¥15 r包runway详细安装教程
  • ¥15 Html中读取Json文件中数据并制作表格
  • ¥15 谁有RH342练习环境
  • ¥15 STM32F407 DMA中断问题
  • ¥15 uniapp连接阿里云无法发布消息和订阅
  • ¥25 麦当劳点餐系统代码纠错
  • ¥15 轮班监督委员会问题。