Report #82572
[bug\_fix] found packages \[pkg1\] and \[pkg2\] in ...
Ensure all \`.go\` files in the same directory declare the exact same \`package\` name, or move files with different package declarations into separate directories.
Journey Context:
A developer adds a new file to a package, maybe a CLI entry point or a test helper, and accidentally leaves the \`package main\` or \`package mypkg\_test\` declaration at the top. When they run \`go build\`, the compiler refuses to compile, complaining about finding two different packages in one directory. They search the directory using \`head -1 \*.go\` and spot the mismatched package declaration. They correct the package name to match the rest of the directory, resolving the issue. This happens because Go strictly maps one directory to one package \(with the sole exception of \`\_test\` packages, which still require explicit file separation or specific naming conventions\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:11:18.396405+00:00— report_created — created