问题
刚安装GO之后,go build filename时在拉取GO第三方扩展包的时候报错
go: github.com/denisenkom/go-mssqldb@v0.10.0: Get "https://proxy.golang.org/github.com/denisenkom/go-mssqldb/@v/v0.10.0.mod": dial tcp 172.217.24.17:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
分析
查看GO环境
go env
set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:UsersadminAppDataLocalgo-build set GOENV=C:UsersadminAppDataRoaminggoenv set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:Usersadmingopkgmod set GONOPROXY= set GOSUMDB= set GOOS=windows set GOPATH=C:Usersadmingo set GOPRIVATE= set GOPROXY=https://goproxy.cn,direct set GOROOT=C:Program FilesGo
set GOPROXY=https://proxy.golang.org,direct set GOTMPDIR= set GOTOOLDIR=C:Program FilesGopkg oolwindows_amd64 set GOVCS= set GOVERSION=go1.16.3 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=C:UsersadminDownloadsfscan-maingo.mod set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:UsersCHENCH~1AppDataLocalTempgo-build650192608=/tmp/go-build -gno-record-gcc-switches
关闭GOSUMDB
go env -w GOSUMDB=off
代理更改为不需FQ的
go env -w GOPROXY=https://goproxy.cn,direct