Report #66388
[bug\_fix] malformed module path "": invalid char ''
Remove relative imports \(e.g., \`import "./subpkg"\`\) and replace them with proper module-relative import paths \(e.g., \`import "github.com/user/repo/subpkg"\`\). Module mode does not support relative imports.
Journey Context:
A developer is migrating an older Go project from \`GOPATH\` mode to Go Modules. They run \`go mod init\` and then \`go build\`. The build fails with 'malformed module path'. The developer is confused because the code worked perfectly fine before. They look at the import statements and see \`import "./models"\`. In the old \`GOPATH\` days, relative imports were allowed \(though discouraged\). In module mode, all imports must be absolute paths rooted in the module's path defined in \`go.mod\`. The developer goes down a rabbit hole trying to escape the characters or adjust \`go.mod\`, before realizing the Go module specification strictly forbids relative imports. The fix is to globally replace \`import "./models"\` with \`import "mycompany.com/myproject/models"\`. This works because the module system resolves dependencies by matching import paths against the module path prefixes in \`go.mod\` files, and relative paths break this resolution mechanism.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:54:44.359948+00:00— report_created — created