The Go Programming Language
› http://golang.org/
› Go Playground
Go Projects
› Revel Web Framework
hujianxin

GOPROXY 不生效

  •  
  •   hujianxin · Oct 13, 2019 · 6943 views
    This topic created in 2577 days ago, the information mentioned may be changed or developed.

    使用的 go 版本是 1.13.1

    vagrant@vagrant:~$ GOPROXY=https://mirrors.aliyun.com/goproxy/ go get -v -u golang.org/x/tools/cmd/gopls
    package golang.org/x/tools/cmd/gopls: unrecognized import path "golang.org/x/tools/cmd/gopls" ( https fetch: Get https://golang.org/x/tools/cmd/gopls?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
    

    哪位大佬遇到过这种情况呢?

    9 replies  •  2019-10-14 14:00:25 +08:00
    gamexg
    gamexg
    Oct 13, 2019
    1
    未设置 GO111MODULE=on ?
    codehz
    codehz
    Oct 14, 2019 via Android
    2
    未设置 go111module 和 gopath 都会有这种问题(
    wweir
    wweir
    Oct 14, 2019 via Android
    3
    jss
    jss
    Oct 14, 2019
    4
    简单点:( GoLand )=> New Project -> Go Modules -> Proxy: https://goproxy.cn
    hujianxin
    hujianxin
    OP
    Oct 14, 2019
    5
    @gamexg @codehz 没错,多谢了。我以为 go1.13 是不需要设置 GO111MODULE=on 的。。。
    icexin
    icexin
    Oct 14, 2019
    6
    1.13 只要目录下有 go.mod 文件就自动开启 mod 模式
    hujianxin
    hujianxin
    OP
    Oct 14, 2019
    7
    @icexin 我就是 go.mod 工程,实测 GOPROXY 不生效,必须手工指定 GO111MODULE=on
    sherlockmao
    sherlockmao
    Oct 14, 2019
    8
    @icexin GO111MODULE=auto 的情况下,监测到 go.mod 会自动用 mod
    hujianxin
    hujianxin
    OP
    Oct 14, 2019
    9
    @sherlockmao 其实这个就是用了 mod 的,1.13 不用设置就行,我 go get 安装的依赖也都是 go modules 依赖,但是 GOPROXY 就是不生效。需要手工设置 GO111MODULE 才可以生效
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1369 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 22:27 · PVG 06:27 · LAX 14:27 · JFK 17:27
    ♥ Do have faith in what you're doing.