zoukankan      html  css  js  c++  java
  • Golang 加速 Go module 加速 Goproxy

    Goproxy China

    The most trusted Go module proxy in China.

    https://goproxy.cn

    Go 1.13 and above (RECOMMENDED)

    Open your terminal and execute

    $ go env -w GO111MODULE=on
    $ go env -w GOPROXY=https://goproxy.cn,direct
    

    done.

    macOS or Linux

    Open your terminal and execute

    $ export GO111MODULE=on
    $ export GOPROXY=https://goproxy.cn
    

    or

    $ echo "export GO111MODULE=on" >> ~/.profile
    $ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
    $ source ~/.profile
    

    done.

    Windows

    Open your terminal and execute

    C:> $env:GO111MODULE = "on"
    C:> $env:GOPROXY = "https://goproxy.cn"
    

    or

    1. Open the Start Search, type in "env"
    2. Choose the "Edit the system environment variables"
    3. Click the "Environment Variables…" button
    4. Under the "User variables for <YOUR_USERNAME>" section (the upper half)
    5. Click the "New..." button
    6. Choose the "Variable name" input bar, type in "GO111MODULE"
    7. Choose the "Variable value" input bar, type in "on"
    8. Click the "OK" button
    9. Click the "New..." button
    10. Choose the "Variable name" input bar, type in "GOPROXY"
    11. Choose the "Variable value" input bar, type in "https://goproxy.cn"
    12. Click the "OK" button
    

    done.


    goproxy.io

    https://goproxy.io

    A Global Proxy for Go Modules

    go env -w GO111MODULE=on
    go env -w GOPROXY="https://goproxy.io,direct"
    
    # Set environment variable allow bypassing the proxy for selected modules (optional)
    go env -w GOPRIVATE="*.corp.example.com"
    
    # Set environment variable allow bypassing the proxy for specified organizations (optional)
    go env -w GOPRIVATE="example.com/org_name"
    

    Now, when you build your applications, Go will fetch dependencies via goproxy.io. See more information in the doc and how to use Private service.

    Go version <= 1.12

    Bash (Linux or macOS)

    # Enable the go modules feature
    export GO111MODULE="on"
    # Set the GOPROXY environment variable
    export GOPROXY="https://goproxy.io"
    

    Or, write it into the .profile or .bash_profile file.

    PowerShell (Windows)

    # Enable the go modules feature
    $env:GO111MODULE="on"
    # Set the GOPROXY environment variable
    $env:GOPROXY="https://goproxy.io"
    

    Now, when you build your applications, Go will fetch dependencies via goproxy.io. See more information in the doc.

  • 相关阅读:
    【存货管理】存货的计价方法
    【NHibernate】列“ReservedWord”不属于表 ReservedWords
    【MySQL】MySQL中where条件的执行分析
    brew卸载&重新安装
    mac nvm安装&使用&一些问题解决方案
    python初始环境配置
    股票数据api整理
    输入一个url到页面渲染完毕过程
    自己简单封装一个promise
    节流&防抖
  • 原文地址:https://www.cnblogs.com/grj1046/p/14252143.html
Copyright © 2011-2022 走看看