Report #65940
[bug\_fix] go: ... is replaced by ... but that replacement is not allowed in ...
Remove the \`replace\` directive from \`go.mod\` and use a properly versioned tag, or use \`go build\` instead of \`go install pkg@version\`.
Journey Context:
A developer uses a \`replace\` directive in \`go.mod\` to point a dependency to a local fork or a specific commit. Everything works locally. They push to CI, and the build fails with 'replacement is not allowed'. Alternatively, they try to install a CLI tool using \`go install github.com/mytool@latest\` and get the same error. The rabbit hole involves trying to pass the replace directive via flags or setting environment variables. The root cause is that \`replace\` directives only apply to the main module; they are completely ignored when the module is used as a dependency by another module, or when using \`go install pkg@version\` \(which runs outside the context of the current module\). The fix is to remove the \`replace\` directive for published modules and instead tag a real release, or build the tool locally using \`go build\` rather than \`go install @version\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:09:32.022700+00:00— report_created — created