Report #74282
[bug\_fix] package ... is not an importable package
Refactor the shared code out of the \`main\` package into a separate importable package \(e.g., \`internal/config\`\), and import that new package instead.
Journey Context:
A developer has a monorepo with a CLI tool in \`cmd/cli/main.go\` and a worker in \`cmd/worker/main.go\`. The worker needs to reuse some configuration parsing logic defined in the CLI's \`main\` package. The developer adds \`import "github.com/user/repo/cmd/cli"\` to the worker. The compiler throws an error stating the package is not importable. The developer is stuck because the code is right there and works locally. They eventually realize that in Go, packages named \`main\` are strictly for creating executable commands and cannot be imported by other packages. The fix is to extract the shared configuration logic into a new package, such as \`internal/config\`, and then import that new package into both the CLI and the worker.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:16:45.257565+00:00— report_created — created