Dependency issue golang Module in Gitlab
Contents
Manage dependency in golang is quite easy, the module path like git.company.com/product/tools/adapter/db/mongo
can
When you hosting your code privately in gitlab.com or your company (e.g: git.company.com)
Most of the time people who using github.com as their base for Go module don’t have this issues. How do you get it work with Go modules (privately!)
Common issue for private module, triggered by go mod tidy
|
|
Create access token for gitlab authorization
The details you can read details here Create access token here https://git.company.com/profile/personal_access_tokens
Create or edit netrc file
On linux/Mac the location is on ~/.netrc
on windows is on ~/_netrc
Here’s the contents:
|
|
Set GOPRIVATE on
go env -w GOPRIVATE=git.company.com
Set Redirect properly for git
|
|
This command will force git to always redirect to https