Solve the problem of error when executing go mod tidy: dial tcp: lookup xxx: no such host

1. Problem description

error message

go: xxx.com/[email protected] (replaced by git.xxx.com/app/[email protected]): Get "https://GOPRIVATE=git.xxx.com/git.xxx.com/app/go-util/@v/v1.0.20.mod": dial tcp: lookup GOPRIVATE=git.xxx.com: no such host

2. Solution

Cause of the problem: Go sets the default GOSUMDB=sum.golang.org, of course it cannot recognize the private domain name xxx.com. The solution is to execute the following command in the project path:

go env -w GOPRIVATE=git.xxx.com 或 go env -w GOSUMDB=off

Guess you like

Origin blog.csdn.net/zhoqua697/article/details/131126713