GOINSECURE permits insecure protocols for modules matching its patterns, but still validates against the checksum database. GOSUMDB=off stops consulting the checksum database entirely. They weaken different protections, and the second one is broader, so prefer the narrowest setting that fixes your problem.
Two layers of protection
Go protects module downloads at two layers:
- Transport: how the module is fetched, normally over HTTPS.
- Content: whether the bytes match what the checksum database and go.sum record.
Each setting touches one of them.
What the reference says
From the Go modules reference:
GOINSECURElists module path prefixes that may be fetched over insecure protocols. It only applies to dependencies fetched directly, and unlike the oldgo get -insecureflag, it does not disable checksum database validation.GOSUMDBdefaults tosum.golang.org. If set tooff, the checksum database is not consulted.GOPRIVATEis a default forGONOPROXYandGONOSUMDB, so listed modules skip the proxy and the checksum database.
The managing dependencies guide adds a related warning for replace directives: Go tools do not authenticate replaced external modules.
Comparison
| Setting | Transport checks | Checksum database | Scope |
|---|---|---|---|
| GOINSECURE | Relaxed for matching prefixes | Still used | Listed prefixes only |
| GONOSUMDB or GOPRIVATE | Unchanged | Skipped | Listed prefixes only |
| GOSUMDB=off | Unchanged | Skipped | Everything |
| replace directive | Unchanged | No authentication | The replaced module |
Decision guide
- Is the module private? Use
GOPRIVATEwith a tight pattern for your organization, not a wildcard. - Is an internal host using an insecure protocol? Prefer fixing the certificate. If you cannot yet, use
GOINSECUREfor only that host. - Is the checksum database unreachable from your network? Use a proxy that can reach it, or an internal mirror, before reaching for
GOSUMDB=off. - If you must turn something off, record who approved it, why, and when it will be reviewed.
- Never put these in a shared shell profile with a wildcard like
*.
Common mistakes
- Setting
GOSUMDB=offin a Dockerfile to silence a build error, then forgetting it. The setting ships in the image and every later build skips verification. - Using a broad
GOPRIVATEsuch as a whole domain that also hosts public code. - Treating
GOINSECUREas if it disabled verification, then assuming a failure means a bug in Go. A checksum failure with GOINSECURE set is the system working.
Remember too that toolchain downloads need the checksum database. With GOSUMDB=off they fail, per the Go toolchain documentation.
Where Safeguard fits
Safeguard's policies and gates can enforce rules on pull requests that change build configuration, and dependency scanning covers what your build resolves. A free scan is a starting point.
Quick check
Does GOINSECURE turn off checksum checks?
No. The Go reference says it does not disable module checksum database validation.
Does GOSUMDB=off affect toolchain downloads?
Yes. They fail without verification.
Sources
Last reviewed: 19 October 2026.