V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
functions

关于 Go 中的包管理如何解决更新慢的问题?

  •  
  •   functions · Jan 7, 2019 · 3359 views
    This topic created in 2669 days ago, the information mentioned may be changed or developed.

    最近在学习 Go 语言,看到 Go 的包管理工具五花八门,实在是让人头大。大家推荐使用 glide 来管理包。 但是更新的源主要是 golang.orggithub.com ,这下载速度惨不忍睹。 特别是当项目发布之后,在测试环境和生产环境都是通过 jenkins 自动部署,每次这么 glide install ,让人很难受啊. 各位大佬有什么好的解决方案?

    10 replies    2019-01-08 10:49:49 +08:00
    u5f20u98de
        1
    u5f20u98de  
       Jan 7, 2019
    配个环境变量,让这些请求走代理就行了
    记着是这些
    export https_proxy=socks5://127.0.0.1:1080
    export http_proxy=socks5://127.0.0.1:1080
    xrlin
        2
    xrlin  
       Jan 7, 2019
    要顺畅用 go,代理必备。
    GGGG430
        3
    GGGG430  
       Jan 7, 2019 via iPhone
    1.11 版本的 mod 有个设置环境变量的代理 GOPROXY,其他的 glide,dep 都不行
    Fitz
        4
    Fitz  
       Jan 7, 2019
    go mod 的话可以设置 GOPROXY 否则只能设置走系统代理了 glide 可以在配置例设置 mirror
    hopingtop
        5
    hopingtop  
       Jan 7, 2019
    vendor 包跟着 git 走,由特定的人维护依赖包版本。目前这种方式我们用着挺好。解决部署拉包的问题。
    znood
        6
    znood  
       Jan 7, 2019
    使用 go1.11 的 gomod,自己部署服务器 athens。或者等 GoCenter 发布
    reus
        7
    reus  
       Jan 8, 2019
    都有 go module 了,还用什么 glide

    export GOPROXY=https://goproxy.io
    或者
    export GOPROXY="https://athens.azurefd.net"
    就能用代理
    functions
        8
    functions  
    OP
       Jan 8, 2019
    感谢大家的解惑。
    看了一遍 go mod 模式,确实比用 glide 方便多了。
    functions
        9
    functions  
    OP
       Jan 8, 2019
    @reus 是的
    functions
        10
    functions  
    OP
       Jan 8, 2019
    @hopingtop 之前还想着在自己的 gitlab 维护这些,但是也是不完美。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1505 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 16:50 · PVG 00:50 · LAX 09:50 · JFK 12:50
    ♥ Do have faith in what you're doing.