Go:gomod获取第三⽅依赖包unknownrevisionxxx错误解决Go: go mod获取第三⽅依赖包unknown revision xxx错误解决
使⽤go mod处理第三⽅依赖包时出现unknown revision xxx错误,解决⽅法如下:
以为例:
[test1280@localhost ~]$ git clone github/go-chassis/go-chassis.git
Initialized empty Git repository in /home/test1280/go-chassis/.git/
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
Receiving objects: 100% (6979/6979), 2.55 MiB | 17 KiB/s, done.
remote: Total 6979 (delta 0), reused 0 (delta 0), pack-reused 6976
Resolving deltas: 100% (4159/4159), done.
[test1280@localhost ~]$ cd go-chassis/
[test1280@localhost go-chassis]$ go mod download
go: finding github/patrickmn/go-cache v2.1.0+incompatible
go: finding github/openzipkin-contrib/zipkin-go-opentracing v0.0.0-20180726151020-b85dc675b16b
go: finding github/cenkalti/backoff v2.0.0+incompatible
unknown怎么处理go: finding github/go-chassis/go-restful-swagger20 v0.0.0-20181221101811-a33c76fe4a6e
go: finding github/hashicorp/go-version v1.0.0
go: finding github/gorilla/websocket v1.4.0
go: finding github/go-chassis/go-archaius v0.7.0
go: finding github/smartystreets/goconvey v0.0.0-20170602164621-9e8dc3f972df
go: github/cenkalti/backoff@v2.0.0+incompatible: unknown revision v2.0.0
go: github/patrickmn/go-cache@v2.1.0+incompatible: unknown revision v2.1.0
go: github/hashicorp/go-version@v1.0.0: unknown revision v1.0.0
go: github/gorilla/websocket@v1.4.0: unknown revision v1.4.0
go: github/go-chassis/go-archaius@v0.7.0: unknown revision v0.7.0
……
有的第三⽅依赖包可以从github到,但是有的不到,报错:unknown revision xxx。
其实go mod调⽤链中会⽤到⼀些git指令,当git版本⽐较旧时,调⽤失败产⽣错误,并给出歧义的提⽰信息。
升级git版本,可参考。
升级完毕后,再尝试go mod:
[test1280@localhost go-chassis]$ git --version
git version 2.20.1
[test1280@localhost go-chassis]$ go mod download
go: finding github/gorilla/websocket v1.4.0
go: finding github/hashicorp/go-version v1.0.0
go: finding github/go-chassis/go-restful-swagger20 v0.0.0-20181221101811-a33c76fe4a6e
go: finding github/cenkalti/backoff v2.0.0+incompatible
go: finding github/openzipkin-contrib/zipkin-go-opentracing v0.0.0-20180726151020-b85dc675b16b go: finding github/patrickmn/go-cache v2.1.0+incompatible
go: finding github/smartystreets/goconvey v0.0.0-20170602164621-9e8dc3f972df
go: finding github/go-chassis/go-archaius v0.7.0
go: finding github/prometheus/common v0.2.0
go: finding github/go-chassis/paas-lager v0.0.0-20181123014243-005283cca84c
go: finding github/json-iterator/go v1.1.5
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding github/pierrec/lz4 v2.0.5+incompatible
go: finding github/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1
go: finding github/golang/protobuf v1.2.0
go: finding github/go-mesh/openlogging v0.0.0-20181122085847-3daf3ad8ed35
go: finding github/go-logfmt/logfmt v0.4.0
go: finding github/go-chassis/go-cc-client v0.5.0
go: finding github/spf13/cast v1.2.0
go: finding github/go-chassis/foundation v0.0.0-20190203091418-304855ea28bf
go: finding github/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165
go: finding github/modern-go/reflect2 v1.0.1
go: finding github/kr/logfmt v0.0.0-20140226030751-b84e30acd515
go: finding github/pkg/errors v0.8.0
go: finding github/stretchr/testify v1.2.2
go: finding github/prometheus/client_golang v0.9.1
go: finding github/prometheus/procfs v0.0.0-20181005140218-185b4288413d
go: finding github/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: finding github/prometheus/client_model v0.0.0-20190115171406-56726106282f
go: finding /ratelimit v0.0.0-20180316092928-c15da0234277
go: finding github/julienschmidt/httprouter v1.2.0
……
已经可以从github上到指定版本的第三⽅依赖包啦!
参考:

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。