Go 私有包的构建和使用

1. 创建一个 Go Modules 项目

  • 创建目录
1
2
mkdir go-test
cd go-test
  • 初始化包
1
2
3
4
5
go mod init gitlab.private.com/shaowenchen/go-test

go: creating new go.mod: module gitlab.private.com/shaowenchen/go-test
go: to add module requirements and sums:
    go mod tidy
  • 添加业务代码