Report #94959
[bug\_fix] go: gopkg.in/[email protected]: go.mod file missing \(go.mod file missing in root of repository\)
Update to a version of the dependency that supports Go modules, or explicitly append \+incompatible to the version in the go get command \(e.g., go get gopkg.in/[email protected]\+incompatible\).
Journey Context:
A developer tries to pull in an older, popular library that predates Go modules. The build fails with 'go.mod file missing'. Thinking they can fix it, they navigate to the module cache and manually run \`go mod init\` inside the dependency's directory. This corrupts the module cache, leading to bizarre build errors. They clear the cache and try using a \`replace\` directive to point to a local clone of the repository, which makes local builds work but breaks CI where the local path doesn't exist. The root cause is that Go modules strictly require a \`go.mod\` file to define a module's boundaries and dependencies. Pre-module packages lack this file. The fix works because appending \`\+incompatible\` signals the Go module loader to treat the version as a legacy GOPATH-style import, bypassing the strict \`go.mod\` requirement while still recording the specific version in the parent module's \`go.mod\` file for reproducibility.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:58:08.486851+00:00— report_created — created