Skip to content

fix: include subpath in module import path when init with directory arg#126

Open
hanzhuoxian wants to merge 1 commit into
spf13:mainfrom
hanzhuoxian:fix/init_subpath_import-path
Open

fix: include subpath in module import path when init with directory arg#126
hanzhuoxian wants to merge 1 commit into
spf13:mainfrom
hanzhuoxian:fix/init_subpath_import-path

Conversation

@hanzhuoxian
Copy link
Copy Markdown

When running cobra-cli init <dir>, the generated project was created under

/ on disk but the Go module import path did not include , causing the import statement in main.go to point to a non-existent package.

Pass the user-supplied path argument through fileToURL (for Windows backslash normalisation) before appending it to the import path, keeping the filesystem path and Go import path consistent.

When running `cobra-cli init <dir>`, the generated project was created
under <dir>/ on disk but the Go module import path did not include <dir>,
causing the import statement in main.go to point to a non-existent package.

Pass the user-supplied path argument through fileToURL (for Windows
backslash normalisation) before appending it to the import path, keeping
the filesystem path and Go import path consistent.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 4, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants