duanpiangeng8958
2018-05-31 04:58
浏览 132
已采纳

升级到1.10后,go get失败,导入路径无法识别

Before setting proxy:

$ 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.)

After setting proxy:

$ 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)

I have tried every solution I could find on StackOverflow. I am still not able to solve this issue.

$ 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

How can I resolve this?

图片转代码服务由CSDN问答提供 功能建议

设置代理之前:

$ go get -u google.golang.org/grpc

 程序包google.golang.org/grpc:无法识别的导入路径“ google.golang.org/  grpc”(https提取:获取https://google.golang.org/grpc?go-get=1:拨打TCP 172.217.160.145:443:已连接:连接尝试失败,因为一段时间后连接方未正确响应 时间或已建立的连接因连接的主机未能响应而失败。)
   
 
 

设置代理后:

$ go get -u google.golang.org/grpc

package google.golang.org/grpc:无法识别的导入路径 “ google.golang.org/grpc"(https提取:获取https://google.golang.org/grpc?go-get=1:proxyconnect tcp:EOF)
   
 \  n 

我尝试了在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 \ sset GOGCCFLAGS = -m64  fmessage-length = 0 -fdebug-prefix-map = C:\ Users \ gayr \ AppData \ Local \ Temp \ go-build135172366 = / tmp / go-build -gno-record-gcc-switches 
  <  / pre> 
 
 

我该如何解决?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • doulangyu9636 2018-05-31 05:18
    最佳回答

    Always set your HTTP_PROXY and HTTPS_PROXY to an http URL

    The proxy itself should be accessed through http, even if your URL query is https

    评论
    解决 1 无用
    打赏 举报

相关推荐 更多相似问题