duan3601 2019-05-14 02:07
浏览 98
已采纳

去上叉的github仓库得到“意外的模块路径”错误

I'm currently working something on AWS Cloudformation which using this repo https://github.com/awslabs/goformation. Because I did some customise so I made a fork https://github.com/vrealzhou/goformation.

Now in my other project (using go module) I'm trying to using go get github.com/vrealzhou/goformation@v2.3.1 and I've got this error:

go: github.com/vrealzhou/goformation@v0.0.0-20190513073615-ff3b65adb278: parsing go.mod: unexpected module path "github.com/awslabs/goformation"
go: error loading module requirements

Does anyone know the reason and how to solve this problem? Thanks

  • 写回答

1条回答 默认 最新

  • duanqiang6501 2019-05-29 13:49
    关注

    You can use replace in your go.mod to use a fork instead of the upstream version. That way, you can make whatever modifications you need to the code without having to update the module path or import paths.

    To be specific, in this case, you can do the following in your go.mod (I tested this by forking the repo, making a small change, and confirming it showed up):

    require github.com/awslabs/goformation v1.4.1
    
    replace github.com/awslabs/goformation => github.com/vrealzhou/goformation master
    

    The first time you build or test, master will be replaced by the latest pseudo-version for your fork to make sure you get repeatable builds. The replace requires a specific version for the replacement.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败