内容简介:注意
起步
go mod需要 1.11
以后的版本才能使用
使用需要设置环境变量 GO111MODULE=on
(可设置三个值,分别是 auto
, on
, off
)
新特性的使用暂时开关,还不确定以后会不会有
注意 go.mod
是可以自己手动编辑的,出现某些需要科学上网步骤,可以使用 replace
来完成模块的引入。
开始
#开启mod特性开关 export GO111MODULE=on #拉取例子仓库 git clone https://github.com/flxxyz/go-mod-example.git && cd go-mod-example #进入例子模块目录 cd src/example #处理依赖 go mod tidy #编译可执行文件(可选系统版本 mac,linux,linux64,windows,windows64) make #进入编译完成目录 cd ../../bin #执行 ./example -h
mod命令
-
go help mod查看mod命令的帮助 -
go mod init <packageName>初始化模块,目录下生成go.mod -
go mod tidy根据go.mod文件来处理依赖关系 -
go list -m all显示依赖文件 -
go mod download <path@version>下载依赖(path是包的路径,version是包的版本) -
go mod vendor复制所有依赖到模块下的vendor目录 -
go mod graph输出模块所需的依赖表 -
go mod verify验证模块的完整性
来源
以上所述就是小编给大家介绍的《一个GO模块的例子》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Text Algorithms
Maxime Crochemore、Wojciech Rytter / Oxford University Press / 1994
This much-needed book on the design of algorithms and data structures for text processing emphasizes both theoretical foundations and practical applications. It is intended to serve both as a textbook......一起来看看 《Text Algorithms》 这本书的介绍吧!
在线进制转换器
各进制数互转换器
HTML 编码/解码
HTML 编码/解码