在设置代理之前:
$ go get -u google.golang.org/grpc
package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial TCP 172.217.160.145:443: connected: 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 get -u google.golang.org/grpc
package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: proxyconnect tcp: EOF)
我尝试过在StackOverflow上找到的所有解决方案。我仍然无法解决这个问题。
$ go env
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\gayr\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\gayr\GolandProjects
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
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 -fmessage-length=0 -fdebug-prefix-map=C:\Users\gayr\AppData\Local\Temp\go-build135172366=/tmp/go-build -gno-record-gcc-switches
我该如何解决这个问题?
答案 0 :(得分:2)
始终将HTTP_PROXY和HTTPS_PROXY设置为 http 网址
即使您的网址查询为https
,也应通过http访问代理本身