go get 安装一个特定版本的包失败解决方法

栏目: Go · 发布时间: 6年前

内容简介:go get 下载第三方包golang gin框架时,会去下载gopkg.in/go-playground/validator.v8包以及gopkg.in/yaml.v2包,gopkg.in站点下的包都是中间包,最终的包代码是在github上,于是直接到github.com上去下载,对应的真实代码地址是:

场景描述

go get 下载第三方包golang gin框架时,会去下载gopkg.in/go-playground/validator.v8包以及gopkg.in/yaml.v2包,gopkg.in站点下的包都是中间包,最终的包代码是在github上,于是直接到github.com上去下载,对应的真实代码地址是:

https://github.com/go-playground/validator/tree/v8.18.2

https://github.com/go-yaml/yaml/tree/v2.2.1

于是,我直接go get github.com/go-playground/validator 以及 go get github.com/go-yaml/yaml来获取,能够顺利下载包,但是在编译自己代码时会报错,仔细看了下是由于下载的包版本不对,并没有下载我们想要的版本,go get直接下载的是最新版本

解决方法

直接用git clone的方式去下载特定tag版本的代码,然后拷贝到相应的包目录下边

git clone --branch v8.18.2 https://github.com/go-playground/validator.git

git clone --branch v2.2.1 https://github.com/go-yaml/yaml.git


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Elements of Information Theory

Elements of Information Theory

Thomas M. Cover、Joy A. Thomas / Wiley-Blackwell / 2006-7 / GBP 76.50

The latest edition of this classic is updated with new problem sets and material The Second Edition of this fundamental textbook maintains the book's tradition of clear, thought-provoking instr......一起来看看 《Elements of Information Theory》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具