golang 编译错误:unknown revision xxx
go mod处理第三方依赖包时出现unknown revision xxx错误。
原因:github上面的一些开源组件,用的git版本是最新的版本。 而编辑机的git版本比较旧,有的git命令没有,导致下载失败。
解决方法:升级git到最新版本(目前是2.35.1)。
sudo apt update # 更新源
sudo apt install software-properties-common # 安装 PPA 需要的依赖
sudo add-apt-repository ppa:git-core/ppa # 向 PPA 中添加 git 的软件源
sudo apt-get update
sudo apt-get install git
还有原因可能是因为golang包是私有包的问题,配置gomod支持私有包下载:
linux配置
export GOPRIVATE=gitlab.xxx.com/xxxx/*
私有仓库问题:
如果是自己搭建的git 服务器。
golang 设置(私有仓库)环境变量:
go env -w GOPRIVATE="gitlab.xxx.com/xxxx/*"linux设置环境变量:
export GOPRIVATE=gitlab.xxx.com/xxxx/*windows设置环境变量:
$env:GOPRIVATE="gitlab.XXXX.com/XXX/*"
或:
git config --global url."git@gitlab.xxxx.com:".insteadOf http://gitlab.xxxx.com/
通过git配置文件设置:
[url "git@gitlab.xxxx.com:"]insteadOf = http://gitlab.xxxxx.com/
记住密码:
git config --global credential.helper store
下载依赖:
go mod tidy或 go mod download
查看需要替换的依赖包:
root@jack-VirtualBox:~/lotus/lotus# grep -rn "20211228030229-6d460d25a0c9" .
./go.mod:54: github.com/filecoin-project/specs-storage v0.1.1-0.20211228030229-6d460d25a0c9
./go.sum:385:github.com/filecoin-project/specs-storage v0.1.1-0.20211228030229-6d460d25a0c9 h1:oUYOvF7EvdXS0Zmk9mNkaB6Bu0l+WXBYPzVodKMiLug=
./go.sum:386:github.com/filecoin-project/specs-storage v0.1.1-0.20211228030229-6d460d25a0c9/go.mod h1:Tb88Zq+IBJbvAn3mS89GYj3jdRThBTE/771HCVZdRJU=
./testplans/lotus-soup/go.sum:474:github.com/filecoin-project/specs-storage v0.1.1-0.20211228030229-6d460d25a0c9 h1:oUYOvF7EvdXS0Zmk9mNkaB6Bu0l+WXBYPzVodKMiLug=
./testplans/lotus-soup/go.sum:475:github.com/filecoin-project/specs-storage v0.1.1-0.20211228030229-6d460d25a0c9/go.mod h1:Tb88Zq+IBJbvAn3mS89GYj3jdRThBTE/771HCVZdRJU=
root@jack-VirtualBox:~/lotus/lotus#
查看本地现有的包版本:
root@jack-VirtualBox:~/lotus/lotus# ls /root/go-path/pkg/mod/github.com/filecoin-project/specs-storage@v0.1.1-0.202*
/root/go-path/pkg/mod/github.com/filecoin-project/specs-storage@v0.1.1-0.20200907031224-ed2e5cd13796:
CONTRIBUTING.md COPYRIGHT go.mod go.sum LICENSE-APACHE LICENSE-MIT Makefile README.md storage/root/go-path/pkg/mod/github.com/filecoin-project/specs-storage@v0.1.1-0.20201105051918-5188d9774506:
CONTRIBUTING.md COPYRIGHT go.mod go.sum LICENSE-APACHE LICENSE-MIT Makefile README.md storage/root/go-path/pkg/mod/github.com/filecoin-project/specs-storage@v0.1.1-0.20211228030229-6d460d25a0c9:
CONTRIBUTING.md COPYRIGHT go.mod go.sum LICENSE-APACHE LICENSE-MIT Makefile README.md storage
root@jack-VirtualBox:~/lotus/lotus#
替换依赖包的版本:
root@jack-VirtualBox:~/lotus/lotus# go mod edit -replace=github.com/filecoin-project/specs-storage@v0.1.1-0.20211228030229-6d460d25a0c9=github.com/filecoin-project/specs-storage@v0.1.1-0.20201105051918-5188d9774506
root@jack-VirtualBox:~/lotus/lotus#
golang 编译错误:unknown revision xxx相关推荐
- Go: go mod获取第三方依赖包unknown revision xxx错误解决
Go: go mod获取第三方依赖包unknown revision xxx错误解决 使用go mod处理第三方依赖包时出现unknown revision xxx错误,解决方法如下: 以go-cha ...
- flutter编译遇到unknown revision or path not in the working tree的错误
最近在Flutter的开发中,引入了几个第三方包,也就是插件,结果在iOS编译的时候,突然编译不过了,报错信息信息如下: Updating spec repo `cocoapods` $ /usr ...
- 错误: Unknown class XXX in Interface Builder file
Unknown class XXX in Interface Builder file 1.错误出现后的现象: (1)例如第一次是自定义的 CornerButton 文件没有找到 导致所有界面中用到 ...
- golang编译错误 copying /tmp/go-build069786374/b001/exe/a.out: No such file or directory 解决方法
问题: linux虚拟机 golang编译 报错 copying /tmp/go-build069786374/b001/exe/a.out: No such file or directory 原因 ...
- 16.编译错误Unknown CMake command “check_symbol_exists“解决
今天编译代码时,突然出现了这个错误 解决办法: 找到出错的CMakeLists文件,在其中添加一行 include(CheckSymbolExists)
- sql语句常见错误:Unknown column 'xxx' in 'where clause该如何解决?
即如下图显示: 翻译得知该列名不存在或者在数据库找不到,先一步步排查 一,先查看数据库 输入的账号密码都没错! 二,检查eclipse中写的sql语句有无错误 粗心的人可能会把数据库中uname列在e ...
- mysql 1054错误 Unknown column 'xxx' in 'field list'
出现问题的代码如下: s = '测试' sql = "INSERT INTO ffff(ID) VALUES (%s)" % (s) try:cursor.execute(sql) ...
- 【错误记录】Kotlin 编译报错 ( Class ‘Xxx‘ is not abstract and does not implement abstract member )
文章目录 一.报错信息 二.解决方案 一.报错信息 Google Play 上架要求 Android 的编译版本 和 目标版本都要高于 30 才可以上传 ; 将 Android 的编译版本 和 目标版 ...
- 完美解决office安装程序失败提示:错误 1402无法打开键UNKNOWN\Components\xxx
最近自己的office不知道为什么崩了,然后就需要重新装office,在安装过程中实在是遇到很多问题,比如: 问题1.说找不到Office.zh_cn\officeMUI.mis officemui. ...
最新文章
- 【Vue】组件复用导致的路由切换时页面不刷新问题
- yolov5改进mark
- 【原创】大叔案例分享(3)用户行为分析--见证scala的强大
- 【Android 属性动画】属性动画 Property Animation 工作原理 ( 线性插值动画 | 非线性插值动画 | 动画计算 | 经过分数 | 插值分数 | 类型估值器)
- Dos批处理中符号作用大全
- 的安装方法_显卡安装方法
- lua中table的常用方法
- Django Drops
- MariaDB Audit Statistics
- 如何搭建个人博客或企业官网
- html自动获取今日的周名称,jquery怎么写显示今天后2周的日历
- 主板插槽接口相关释义
- JS中的showModelDialog详解和实例
- 华为路由器内部服务器地址映射不起作用,第一次买华为AR2204-s路由,内部服务器映射问题...
- eplan好看的电缆图表_EPLAN电缆图表模板
- VS2017使用C#编写COM组件
- 批量备注订单(淘宝/天猫/1688/拼多多/京东/抖音/快手)
- XISE-WBMS管理V30.0最新无后门过狗过WAF版
- 腾讯地图SDK公交路线规划Demo
- 计算机定时开机关机设置,怎样设置电脑定时开机关机