Skip to main content
Root Library Catalog supports Go modules. Patched modules are served through the GOPROXY protocol and consumed via replace directives in your go.mod file.

Prerequisites

The Root Patcher CLI (rootio_patcher) is required to analyze your dependencies and inject the necessary replace directives. Install it before configuring your Go environment.
For macOS Intel and Windows, see the full installation instructions. Then set your API key:

How Root Go modules work

Go modules are patched in a Docker build environment and published to pkg.root.io/gobinary via the GOPROXY protocol. Patched modules keep their original module identity (e.g., module github.com/google/uuid) and are consumed using Go’s native replace directive in go.mod, requiring zero changes to application source code. Root publishes patched modules with the same version plus a -rootio.N suffix. For example:
The patcher analyzes your go.mod, queries Root’s API for available patches, and adds replace directives pointing to the Root-patched versions.
Only modules with pinned semver versions (e.g., v1.2.3) are analyzed. Modules using pseudo-versions (e.g., v0.0.0-20230101123456-abcdef012345) are skipped. If you have vulnerable pseudo-versioned dependencies, upgrade them to a pinned release first.

Authentication

Go’s module proxy system authenticates via the GOPROXY environment variable. This is the only environment variable you need to configure for regular builds:
This tells Go to:
  1. Try resolving modules from pkg.root.io/gobinary first (with authentication)
  2. Fall back to the public Go proxy at https://proxy.golang.org
  3. Finally fall back to direct for modules not available through either proxy
You can also set this persistently:
No GONOSUMDB needed! Once the patcher runs go mod tidy and generates your go.sum file, regular builds use the checksums from go.sum for verification. Go only queries the checksum database when adding new modules, which the patcher handles internally.GOPRIVATE: If your project also imports internal/private modules (common in monorepos), set GOPRIVATE to cover those module paths so Go doesn’t attempt to fetch them through the proxy or checksum database. For example: export GOPRIVATE="github.com/myorg/internal,*.mycompany.com". This is unrelated to Root patches — it applies to any private module your project depends on.

Patching your project

1. Preview available patches

Run the patcher in dry-run mode (no ROOTIO_API_KEY needed for discovery):
This shows which modules have Root-patched versions available and which CVEs they fix.

2. Apply patches

Run the patcher with --dry-run=false to update your go.mod:
The patcher will:
  1. Add replace directives to your go.mod
  2. Automatically run go mod tidy to fetch the patched modules
  3. Run go mod vendor if a vendor/ directory exists

3. Build your project

After patching, build as usual:
The build will use the patched modules from pkg.root.io/gobinary via the replace directives.

Example workflow

Working with go.mod

After running the patcher, your go.mod will contain replace directives like:
Your import statements remain unchanged:
The replace directives transparently redirect module resolution to Root’s patched versions at build time.

CI/CD Configuration

In CI/CD environments, you only need to set GOPROXY - the committed go.sum file provides checksum verification.

GitHub Actions

No GONOSUMDB needed! The go.sum file committed in your repo contains all the checksums. Go uses those for verification during builds.

GitLab CI

Docker builds

Checksum verification and go.sum

Go’s module system uses checksums for security. Here’s how it works with Root patches:

How go.sum provides security

When the Root Patcher runs go mod tidy, it:
  1. Downloads the patched modules from pkg.root.io/gobinary
  2. Calculates their checksums
  3. Writes those checksums to your go.sum file
During regular builds (go build, go test, Docker builds):
  • Go reads the checksums from your committed go.sum file
  • Go downloads modules and verifies them against go.sum
  • Go does not query the checksum database (sum.golang.org)
  • Your go.sum is the source of truth
This means:
  • ✅ Cryptographic verification is still active via go.sum
  • ✅ No environment variables needed beyond GOPROXY
  • ✅ Reproducible builds across all environments
  • ✅ Git tracks the checksums (commit go.sum with your code)

When GONOSUMDB is used

The Root Patcher sets GONOSUMDB=pkg.root.io internally when it runs go mod tidy. This allows it to download patched modules from Root’s registry without querying the public checksum database. You don’t need to set this yourself - the patcher handles it automatically.

If you manually run go mod tidy

If you need to run go mod tidy manually after the patcher has added replace directives:
But this is rarely needed - the patcher runs go mod tidy automatically after updating your go.mod.

Troubleshooting

Multi-module projects

For projects with multiple Go modules (e.g., monorepos), run the patcher from the root and specify each module:
Or iterate over all modules:

Version pinning

Root patches are tied to specific upstream versions. If you upgrade a dependency to a newer version, run the patcher again to check if a Root patch is available for the new version:

Go Standard Library (stdlib) Limitations

Root Library Catalog does not support patching Go’s standard library packages (e.g., net/http, crypto/tls, encoding/json). Stdlib packages are part of the Go toolchain itself and cannot be patched using the replace directive mechanism that Root uses for external modules.

Why stdlib patching is not supported

Unlike external Go modules where Root can publish patched versions and use replace directives in go.mod to redirect module resolution, the Go standard library is:
  1. Embedded in the toolchain - stdlib packages are compiled from sources bundled with the Go binary itself
  2. Not replaceable via go.mod - Go’s module system does not support replace directives for stdlib packages
  3. Tied to the Go version - The stdlib version is determined by the go directive at the top of go.mod (e.g., go 1.22.3)
Keep your Go version up to date. Unlike third-party packages where version upgrades may introduce breaking changes, Go’s standard library maintains exceptional backwards compatibility. The Go team at Google maintains stdlib with:
  • Strong backwards compatibility guarantees
  • Rapid security response times
  • Regular patch releases for security issues
  • Comprehensive test coverage
When a stdlib CVE is announced:
  1. Upgrade to the latest patch version of your current Go minor version:
  2. Update your go.mod:
  3. For Dockerfile-based builds, update your base image:
This approach provides the most reliable security posture for stdlib vulnerabilities without compromising build reproducibility.