Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring GOPROXY Environment Variables

Symptom

When installing Glide, an error is reported stating "unrecognized import path 'golang.org/x/sys/unix'."

Procedure

  1. View the Go version.
    1
    go version
    

    Go 1.11 and later have GOPROXY environment variables. If you set the environment variables, the proxy address specified by the environment variables is used for downloading the Go source code, instead of directly downloading the source code from the code library.

  2. Open the profile file.
    1
    vi /etc/profile
    
  3. Add the following content to the file. Save the file and exit.
    1
    2
    export GOPROXY=https://goproxy.io
    export GO111MODULE=on
    
  4. Make the environment variables take effect.
    source /etc/profile
  5. View the environment variables.
    1
    2
    echo $GOPROXY
    echo $GO111MODULE