I have a dependency which is published in company's GitLab and is only discoverable with domain name from a certain dns server. The go get
command is failing to fetch such dependency on my local environment like this:
go get our-domain.com/group/library@v0.1.0
go: our-domain.com/group/library@v0.1.0: verifying go.mod: our-domain.com/group/library@v0.1.0/go.mod: reading https://sum.golang.org/lookup/our-domain.com/group/[email protected]: 410 Gone
server response: not found: our-domain.com/group/library@v0.1.0: unrecognized import path "our-domain.com/group/library": https fetch: Get "https://our-domain.com/group/library?go-get=1": dial tcp: lookup our-domain.com on 8.8.8.8:53: no such host
It works if I'm building inside docker with adding dns to /etc/docker/daemon.json
{ "dns": ["1.2.3.4"] }
How to do it for getting dependency locally? Running on MacOs with go1.13
I tried to add DNS address to the Network settings but go get
still doesn't use it.
CodePudding user response:
Try set GOPRIVATE=our-domain.com
.
go env -w GOPRIVATE=our-domain.com
Otherwise the command tries to resolve the name using the Go proxy and checksum db.