Report #3635
[bug\_fix] go: go.mod file not found when running go get outside of a module, or go get modifying the current project's go.mod when trying to install a global CLI tool
Use \`go install example.com/cmd/tool@latest\` \(or a specific version like \`@v1.2.3\`\) to install executable binaries globally. Reserve \`go get\` for adding or updating dependencies in the current module's \`go.mod\`.
Journey Context:
A developer follows an outdated tutorial to install a CLI tool using \`go get -u github.com/foo/bar\`. It either fails with \`go: go.mod file not found\` if they are outside a module, or worse, it silently adds the CLI tool as a dependency to their current project's \`go.mod\`, cluttering it. They try setting \`GO111MODULE=off\` to revert to GOPATH behavior, which breaks their actual module builds. The root cause is a major behavioral change introduced in Go 1.16: \`go get\` is no longer allowed to build and install executables; its sole purpose is now managing dependencies in \`go.mod\`. The \`go install\` command was updated to accept version suffixes \(e.g., \`@latest\`, \`@v1.0.0\`\) specifically for installing executables globally without affecting the current module. Using \`go install ...@version\` is the established way to install tools without a \`go.mod\` context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T17:50:26.257504+00:00— report_created — created