In one of my projects I've used an internal module:
package main
import (
"gitlab.example.com/team/project/internal/exitcodes"
)
That worked fine.
Now I need that module in another project as well and I fail to achieve that.
First I created a new repository where I put the module: gitlab.example.com/team/gocommon
and changed the import accordingly to "gitlab.example.com/team/gocommon/exitcodes".
Then I created an accesstoken and put it into ~/.netrc
machine gitlab.example.com
login gogettoken
password DBJMsPsGrFAiMq2MDRRT
But the project fails to build with:
gitlab.example.com/team/gocommon/exitcodes: gitlab.example.com/team/[email protected]: verifying module: gitlab.example.com/team/[email protected]: reading https://sum.golang.org/lookup/gitlab.example.com/team/[email protected]: 404 Not Found
server response:
not found: gitlab.example.com/team/[email protected]: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/5c5d3cb0b00b8d48278234b7d0c82797966117d16c9fedbd2cf87e471d549e5b: exit status 128:
fatal: could not read Username for 'https://gitlab.example.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
I already checked the mentioned golang.org link, but it didn't help me ot find a solution.
Looks like you have problems with ssh git and https git. Is somebody in your company already done it? May be there are some security issue with infrastructure configuration.
Check few things without order, just any of this list might help you to understand where is the problem:
go mod tidy
go get <package>
by hand