Skip to content
Latchkey

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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →