Root Library Catalog supports Go modules. Patched modules are served through the GOPROXY protocol and consumed viaDocumentation Index
Fetch the complete documentation index at: https://docs.root.io/llms.txt
Use this file to discover all available pages before exploring further.
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.
How Root Go modules work
Go modules are patched in a Docker build environment and published topkg.root.io/go 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:
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 theGOPROXY environment variable. This is the only environment variable you need to configure for regular builds:
- Try resolving modules from
pkg.root.io/gobinaryfirst (with authentication) - Fall back to the public Go proxy at
https://proxy.golang.org - Finally fall back to
directfor modules not available through either proxy
No GONOSUMDB or GOPRIVATE 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.Patching your project
1. Preview available patches
Run the patcher in dry-run mode (noROOTIO_API_KEY needed for discovery):
2. Apply patches
Run the patcher with--dry-run=false to update your go.mod:
- Add
replacedirectives to yourgo.mod - Automatically run
go mod tidyto fetch the patched modules - Run
go mod vendorif avendor/directory exists
3. Build your project
After patching, build as usual:pkg.root.io/go via the replace directives.
Example workflow
Working with go.mod
After running the patcher, yourgo.mod will contain replace directives like:
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 setGOPROXY - 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 runsgo mod tidy, it:
- Downloads the patched modules from
pkg.root.io/gobinary - Calculates their checksums
- Writes those checksums to your
go.sumfile
go build, go test, Docker builds):
- Go reads the checksums from your committed
go.sumfile - Go downloads modules and verifies them against
go.sum - Go does not query the checksum database (
sum.golang.org) - Your
go.sumis the source of truth
- ✅ 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.sumwith your code)
When GONOSUMDB is used
The Root Patcher setsGONOSUMDB=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 rungo mod tidy manually after the patcher has added replace directives:
go mod tidy automatically after updating your go.mod.
Troubleshooting
| Issue | Solution |
|---|---|
401 Unauthorized | Verify GOPROXY includes your ROOTIO_API_KEY and the token is valid |
| Module not found | Confirm the patched module exists at pkg.root.io/gobinary or check the dry-run output |
| Checksum mismatch during build | Ensure go.sum is committed and up-to-date - the patcher generates this automatically |
Checksum mismatch during manual go mod tidy | Set GONOSUMDB="pkg.root.io" before running go mod tidy |
| Pseudo-version dependencies | Upgrade to a pinned semver version - the patcher only supports semver |
replace not working | Ensure go mod tidy has been run and GOPROXY is configured before building |