# BackendCommon 后端公共库 ## 私有库导入步骤 #### 1.配置环境变量 ``` go env -w GOINSECURE="git.gzquan.cn" go env -w GOPRIVATE="git.gzquan.cn" ``` #### 2.gitlab部署ssh公钥 参考 [http://g.lenovo.com.cn/help/user/ssh.md](http://g.lenovo.com.cn/help/user/ssh.md) #### 3.如果提示还要username的话,git映射为ssh认证 ``` git config --global --add url."git@git.gzquan.cn:".insteadOf "http://git.gzquan.cn/" ``` #### 4.导入 ``` go get git.gzquan.cn/pkg/go-common ``` #### 5.指定包版本/commit 项目迭代期间不必要每次提交都新建tag,代码commit到main分支即可,待版本迭代基本完成后新建新的tag版本。私有库指定commit版本,步骤: 1.修改go.mod文件 修改后缀版本,改成tag版本号(如:v1.0.55)或commit hash (如:2fd581b1) ```go require ( git.gzquan.cn/pkg/go-common 2fd581b1 github.com/Masterminds/squirrel v1.5.4 github.com/apolloconfig/agollo/v4 v4.1.1 ... ) ``` 2.命令行执行 ```shell go mod tidy ```