Report #6389
[bug\_fix] go: go.mod file is malformed: invalid go version
Change the \`go\` directive in \`go.mod\` to use only the major and minor version numbers \(e.g., \`1.22\` instead of \`1.22.0\` or \`v1.22\`\).
Journey Context:
A developer manually creates a \`go.mod\` file or automates its generation using a CI environment variable like \`go version\` \(which outputs \`go1.22.0\`\). They set the \`go\` directive to \`go 1.22.0\`. When they run \`go build\`, they get a malformed \`go.mod\` error. They are confused because their installed Go version is indeed \`1.22.0\`. The root cause is a strict formatting rule in the Go module specification: the \`go\` directive in \`go.mod\` only accepts the major and minor release numbers, omitting the patch version and any leading 'v'. The fix is to edit the \`go.mod\` file and change \`go 1.22.0\` to \`go 1.22\`. The Go toolchain uses the patch version internally but explicitly forbids it in the \`go.mod\` syntax to maintain consistency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:52:38.635769+00:00— report_created — created