发布Go语言模块
发布Go语言模块
代码仓库
模块初始化
go mod init github.com/leeyongit/goutilbmodule github.com/leeyongit/goutils
go 1.19package goutils
const version = "v1.0.0"
func Version() string {
return version
}发布步骤
Last updated
go mod init github.com/leeyongit/goutilbmodule github.com/leeyongit/goutils
go 1.19package goutils
const version = "v1.0.0"
func Version() string {
return version
}Last updated
# 提交代码
git add .
git commit -m "first version"
# 打标签
git tag v1.0.0GOPROXY=proxy.golang.org go list -m github.com/leeyongit/[email protected]# 默认获取最新版本
go get github.com/leeyongit/goutils
# 获取指定版本
go get github.com/leeyongit/[email protected]