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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题