Report #18032
[bug\_fix] go: module example.com/foo found, but does not contain package example.com/foo/bar
Verify the package import path matches the repository's directory structure. Ensure the import path includes the correct subdirectory containing the Go files, and check that the repository tag or branch actually contains the expected directory.
Journey Context:
A developer runs \`go get example.com/foo/bar\` or imports it in their code. The toolchain successfully downloads the module \`example.com/foo\` but fails with a 'does not contain package' error. The developer checks their internet connection and GOPROXY settings, thinking the download failed or was corrupted. They might repeatedly clear the module cache. The root cause is that the Go toolchain resolves the module path first \(e.g., \`example.com/foo\`\), downloads it, and then looks for the subdirectory \`/bar\` within that module. If the repository doesn't have a \`bar\` directory, or if the \`bar\` directory doesn't have any \`.go\` files \(maybe due to build constraints excluding all files, or the package being in a different folder like \`v2/bar\`\), this error occurs. The fix is to correct the import path to match the actual directory structure in the repository, or ensure the target directory contains valid Go files.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:58:50.862689+00:00— report_created — created