栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

修复go使用的工具版本

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

修复go使用的工具版本

使用go模块的go1.11解决方案是创建一个伪造的工具包。您可以如下创建一个
tools.go 文件:

// +build toolspackage toolsimport (        _ "github.com/tebeka/go2xunit")

+ build tools是一个神奇的注释,它阻止构建软件包。

>go mod init tools

将为假 工具 包创建一个 go.mod 文件 __

>go install github.com/tebeka/go2xunit

将如下安装go2xunit并更新go.mod。

module toolsrequire github.com/tebeka/go2xunit v1.4.8 // indirect

现在,如果您将来运行 go install github.com/tebeka/go2xunit
(对于干净的构建说),它的版本将由go.mod固定为v1.4。


对于1.11之前的版本,要使用的工具是retool。它是这样的:

引导程序:

go get github.com/twitchtv/retool

添加工具:

retool add github.com/jteeuwen/go-bindata/go-bindata origin/master

使用工具:

retool do go-bindata -pkg testdata -o ./testdata/testdata.go ./testdata/data.json

对此的支持可能是针对go
1.12的路线图(https://github.com/golang/go/issues/27653)



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/484250.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号