How to Set Up a Private Go Module Proxy

Configure the GOPROXY environment variable to point to your private Go module proxy URL.

Set the GOPROXY environment variable to your private proxy URL to configure the Go module proxy. This tells the Go toolchain to fetch dependencies from your server instead of the public proxy.

export GOPROXY=https://your-private-proxy.example.com,direct

To make this permanent, add the export command to your shell configuration file (e.g., ~/.bashrc or ~/.zshrc).