In Linux or macOS, you can execute the below commands.
1 | # Enable the go modules feature |
Or, write it into the .bashrc
or .bash_profile
file.
In Windows, you can execute the below commands.
PowerShell Copy
1 | # Enable the go modules feature |
Now, when you build and run your applications, go will fetch dependencies via goproxy.io. See more information in the goproxy repository.
If your Go version >= 1.13, the GOPRIVATE environment variable controls which modules the go command considers to be private (not available publicly) and should therefore not use the proxy or checksum database. For example:
Go version >= 1.13 Copy
1 | go env -w GOPROXY=https://goproxy.io,direct |