Introduction
The Go module proxy (proxy.golang.org) returns HTTP 410 Gone when it cannot find a module or when the module has been removed. For private repositories, the public proxy will never have the module, so you must configure Go to bypass the proxy for private module paths.
This issue commonly affects organizations using private Git repositories for internal Go packages.
Symptoms
- go mod download fails with "410 Gone" for a private module path
- Error: "module declares its path as github.com/myorg/private but was required as..."
- Public modules download fine but private ones fail with proxy errors
Common Causes
- GOPRIVATE not configured, so private modules are routed through the public proxy
- Private repository was moved or made inaccessible
- Module checksum mismatch due to tag being force-pushed
Step-by-Step Fix
- 1.Configure GOPRIVATE for private repositories: Tell Go to bypass the proxy for private modules.
- 2.```bash
- 3.# Set GOPRIVATE to your organization's module path:
- 4.go env -w GOPRIVATE="github.com/myorg/*"
# Or multiple patterns: go env -w GOPRIVATE="github.com/myorg/*,gitlab.com/company/*"
# Verify: go env GOPRIVATE # Output: github.com/myorg/* ```
- 1.Configure Git authentication for private repos: Ensure Go can clone private repositories.
- 2.```bash
- 3.# For GitHub with PAT:
- 4.git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
# Or use SSH: git config --global url."git@github.com:".insteadOf "https://github.com/"
# Then verify: go get github.com/myorg/private@latest ```
- 1.Configure GONOSUMCHECK and GONOSUMDB: Skip checksum verification for private modules.
- 2.```bash
- 3.# These are automatically set by GOPRIVATE, but you can set explicitly:
- 4.go env -w GONOSUMCHECK="github.com/myorg/*"
- 5.go env -w GONOSUMDB="github.com/myorg/*"
- 6.
` - 7.Set up a private Go module proxy: Run your own proxy for both public and private modules.
- 8.```bash
- 9.# Use Athens proxy for private modules:
- 10.docker run -p 3000:3000 gomods/athens:latest
# Point Go to your proxy: go env -w GOPROXY="https://proxy.mycompany.com,direct" ```
Prevention
- Set GOPRIVATE during development environment setup
- Use a private Go module proxy like Athens for organizational packages
- Include GOPRIVATE configuration in your project's Makefile or setup scripts
- Use SSH-based Git authentication for reliable access to private repos