常规配置:
go env -w GOPRIVATE=gitlab.example.com
go env -w GONOPROXY=gitlab.example.com
git config --global url."git@gitlab.example.com:".insteadOf https://gitlab.example.com/
groups目录下的仓库:
假如git仓库如下:
https://gitlab.example.com/company_name/group_name/project_name.git
此时go.mod里的module命名不能是:
gitlab.example.com/company_name/group_name/project_name
要在结尾加上.git
go mod init gitlab.example.com/company_name/group_name/project_name.git
这样就可以了
参考:Gitlab Subgroups and Go Modules Names - A place to gather bits and bytes.