Safeguard
Supply Chain•

What happens to your Go build if a dependency repository is deleted?

Go's module mirror caches versions and the checksum database fixes contents, but only vendoring or your own proxy guarantees a build. Options compared.

Safeguard Security Team
3 min read

Usually your build keeps working, because the default module proxy caches module versions and most builds fetch through it. But a cache is not a promise. Only a vendor directory or a proxy you run guarantees you can build when an upstream repository disappears.

What Go does by default

The Go team's supply chain article describes the Go module mirror as a proxy that caches module versions. Authors do not register an account or upload versions to it. The default GOPROXY is https://proxy.golang.org,direct, so the go command asks the mirror first and falls back to version control. A comma means the next entry is tried only on a 404 or 410 response.

The checksum database is separate. It is a global append only list of go.sum entries, so everyone who gets a given version should get the same contents.

What can go wrong

  • A version you never fetched before is not in your caches, and may not be in the mirror.
  • Private modules skip the public mirror by design, so their availability is your own hosting.
  • Corporate caches expire, and CI runners often start empty.
  • If a module is gone and GOPRIVATE or direct fetches are involved, builds fail at download time.

Options compared

OptionBuild survives repo deletion?Cost
Public mirror onlyOften, not guaranteedNone
Persistent module cache in CIFor versions already cachedCache management
Internal proxy that stores versionsYes, for versions it has fetchedRun and secure a service
go mod vendorYes, builds from the repo itselfLarger repo, review of vendored diffs

The Go reference says -mod=vendor uses the vendor directory and does not use the network or the module cache. See when to vendor.

Steps to prepare

  1. List your critical dependencies and note which are private.
  2. Decide the guarantee you need. Most teams can accept the public mirror for open source and require control only for production release builds.
  3. If you need control, stand up an internal proxy and point GOPROXY at it, or vendor.
  4. Rehearse: run a clean build with GOPROXY=off and see what fails. That setting means no communication is attempted, per the Go reference.
  5. Keep go.sum committed, so any replacement copy is checked against the original hash.

What deletion does not mean

A deleted repository could also reappear under another owner. Your go.sum hashes protect you there: new contents under the same version fail verification. That is one reason not to remove or regenerate go.sum casually.

Where Safeguard fits

Safeguard's SBOM and dependency scanning record exactly which module versions your builds used, which helps when you need to rebuild or investigate. Try a free scan.

Quick check

Does the Go mirror guarantee availability?

No. It caches versions, but the Go documentation does not promise permanent availability.

What does GOPROXY=off do?

It tells the go command to attempt no communication, which makes it a good test of offline builds.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.