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.

  • 相关阅读:
    关于抽象类
    封装.继承.多态
    构造方法
    String
    无参方法与有参方法
    类和对象
    使用分层实现业务处理(二)
    使用分层实现业务处理(一)
    序列化Serializable接口
    用JSP从数据库中读取图片并显示在网页上
  • 原文地址:https://www.cnblogs.com/grj1046/p/14252143.html
Copyright © 2011-2022 走看看