一.依赖包管理
python有pip方便第三方包管理,java拥有maven管理。
go在旧版本中可以使用go get
命令获取第三方包, 但是偶尔第三方也存在依赖,这样包管理不是很方便
在go 1.12版本后,增加了go mod
来进行依赖包管理, 方便了许多,因此建议使用1.12以上版本(可自行到官网下载)
查看版本
> go version
go version go1.13.9 windows/amd64
>go mod
Go mod provides access to operations on modules.
Note that support for modules is built into all the go commands,
not just 'go mod'. For example, day-to-day adding, removing, upgrading,
and downgrading of dependencies should be done using 'go get'.
See 'go help modules' for an overview of module functionality.
Usage:
go mod <command> [arguments]
The commands are:
download download modules to local cache
edit edit go.mod from tools or scripts
graph print module requirement graph
init initialize new module in current directory
tidy