GOPRIVATE Environment

The go command defaults to downloading modules from the public Go module mirror at It also defaults to validating downloaded modules, regardless of source, against the public Go checksum database at These defaults work well for publicly available source code.

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. The variable is a comma-separated list of glob patterns (in the syntax of Go's path.Match) of module path prefixes. For example,


causes the go command to treat as private any module with a path prefix matching either pattern, including,, and

if your private repos belonged to a organization, such as a github organization org_name, just type the organization name:

The GOPRIVATE environment variable may be used by other tools as well to identify non-public modules. For example, an editor could use GOPRIVATE to decide whether to hyperlink a package import to a page.

For fine-grained control over module download and validation, the GONOPROXY and GONOSUMDB environment variables accept the same kind of glob list and override GOPRIVATE for the specific decision of whether to use the proxy and checksum database, respectively.

For example, if a company ran a module proxy serving private modules, users would configure go using:


This would tell the go command and other tools that modules beginning with a subdomain are private but that the company proxy should be used for downloading both public and private modules, because GONOPROXY has been set to a pattern that won't match any modules, overriding GOPRIVATE.

Special Sponsors

YunZhanghu Inc