modules-and-toolchain.mdMarkdown, rendered
Go Modules and Toolchain (2026)
Module-first baseline
- Use Go modules as the default project model.
- Keep a committed
go.mod(and usuallygo.sum) for reproducible builds. - Prefer explicit dependency operations (
go get,go mod tidy) over ad-hoc edits.
go line and toolchain semantics
- The
goline ingo.modexpresses the minimum required Go language/toolchain semantics for the module. - Modern Go supports explicit toolchain selection via
toolchaindirectives and environment policy viaGOTOOLCHAIN. - For teams on mixed local environments, set clear policy: minimum supported
goline, optional preferred toolchain, CI pinned to a known stable release.
Practical workflow
go mod tidy
go test ./...
go vet ./...
For version/toolchain updates, validate in CI before broad rollout.
Notes from current release cycle
- Go 1.26 (released 2026-02-10) continues six-month cadence and compatibility guarantees.
go mod initbehavior now encourages compatibility with currently supported versions by defaulting a lower initialgoversion; teams can still adjust viago get go@version.
Sources
- Toolchains doc: https://go.dev/doc/toolchain
- Modules reference: https://go.dev/ref/mod
- Go release history: https://go.dev/doc/devel/release
- Go 1.26 notes: https://go.dev/doc/go1.26