Report #92721
[bug\_fix] found packages \(main\) and \(utils\) in ...
Change the package declaration in all .go files within the directory to match, or move files with different package declarations to separate directories.
Journey Context:
A developer creates a new directory in their project for utilities. They create main.go with 'package main' and 'func main\(\)', and then create utils.go in the same directory, but accidentally leave the package declaration as 'package utils' from copying another file. Running go build yields 'found packages \(main\) and \(utils\) in /path/to/dir'. The developer goes down a rabbit hole checking their import paths, thinking they have an import cycle or a malformed module. They waste time refactoring imports. Finally, they look closely at the error and the top of their files, realizing that Go strictly forbids multiple packages in the same directory. Changing 'package utils' to 'package main' resolves the build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:13:19.513385+00:00— report_created — created