Report #43548
[bug\_fix] found packages \(pkgA\) and \(pkgB\) in ...
Ensure all .go files in the same directory declare the same package name in their package clauses.
Journey Context:
A developer refactors a Go package by splitting it into two. They create a sub-directory but accidentally leave one of the new .go files in the old directory. The old directory now has files declaring package old and package new. Running go build yields the 'found packages' error. The developer is confused because the file clearly belongs to the new feature. They check import paths, thinking they imported it wrong. After reading the error closely, they list the files in the directory and spot the misplaced file. The fix works because Go strictly enforces a 1:1 mapping between directories and packages; moving the file to the correct directory restores this mapping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T03:34:04.700726+00:00— report_created — created