What Is go.mod?
go.mod explained, including what it does and how it matters in CI/CD.
go.mod is the file that defines a Go module: its path, Go version, and dependency requirements.
What it is
It lists required modules and their minimum versions. The companion go.sum records cryptographic checksums for integrity.
Why it matters in CI/CD
CI runs go build/go test, which read go.mod and verify against go.sum. Use -mod=readonly (the CI default) so the build fails rather than silently editing go.mod.
Key takeaways
- go.mod defines a Go module and its deps.
- go.sum locks checksums.
- CI verifies both for integrity.
Related guides
What Is go.sum?go.sum records checksums for Go dependencies. Learn its security role in CI.
What Are Go Modules? Go Dependency Management ExplainedGo modules explained: how Go manages dependencies with go.mod and go.sum, a usage example, their role in CI/C…
What Is a Lockfile and Why Should You Commit It?A lockfile pins the exact versions of every dependency so builds are reproducible. Learn why committing it is…