下面是一份 go get
命令大全,并且每个命令都有详细的中文注释:
安装指定包
go get github.com/gen2brain/go-unarr
这条命令会下载并安装 github.com/gen2brain/go-unarr
包,并且更新 go.mod
文件中的依赖项。
更新包到最新版本
go get -u github.com/gen2brain/go-unarr
这条命令会下载并更新 github.com/gen2brain/go-unarr
包到最新版本,并且更新 go.mod
文件中的依赖项。
详细模式
go get -v github.com/gen2brain/go-unarr
-v
标志启用详细模式,显示下载和安装过程中的详细信息。
更新所有依赖包
go get -u ./...
这条命令会更新当前模块及其子模块中所有的依赖包到最新版本。
安装指定版本
go get github.com/gen2brain/go-unarr@v0.2.3
这条命令会下载并安装 github.com/gen2brain/go-unarr
的 v0.2.3
版本。
安装最新预发行版本
go get github.com/gen2brain/go-unarr@latest
这条命令会下载并安装 github.com/gen2brain/go-unarr
的最新预发行版本(包括 beta
和 rc
版本)。
只更新间接依赖
go get -u=patch github.com/gen2brain/go-unarr
这条命令会只更新 github.com/gen2brain/go-unarr
及其间接依赖到最新补丁版本。
跳过 go.mod
文件
GO111MODULE=off go get github.com/gen2brain/go-unarr
这条命令会在 GOPATH
模式下下载并安装 github.com/gen2brain/go-unarr
包,忽略 go.mod
文件。
清理模块缓存
go clean -modcache
这条命令会清理本地模块缓存。
下载但不安装
go get -d github.com/gen2brain/go-unarr
-d
标志表示只下载包但不安装。
设置代理
export GOPROXY=https://proxy.golang.org go get github.com/gen2brain/go-unarr
这两条命令会设置 Go 代理并下载 github.com/gen2brain/go-unarr
包。
调试包依赖
go get -x github.com/gen2brain/go-unarr
-x
标志会显示编译时的每个命令。
使用 go get
命令,可以方便地管理 Go 项目的依赖包。通过结合不同的标志和选项,可以实现包的下载、安装、更新和调试。详细的选项和标志有助于精细化管理依赖包。