Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: show files in import cycle errors #68407

Closed
xin-tsla opened this issue Jul 12, 2024 · 2 comments
Closed

cmd/go: show files in import cycle errors #68407

xin-tsla opened this issue Jul 12, 2024 · 2 comments
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@xin-tsla
Copy link
Contributor

xin-tsla commented Jul 12, 2024

Proposal Details

Hi All,
The proposal is to add more details, line numbers, for import cycle not allowed error.
Currently the stack of cyclic import error is the following:

package cyclic-import-example
        imports cyclic-import-example/packageA
        imports cyclic-import-example/packageB
        imports cyclic-import-example/packageA: import cycle not allowed

In a repo with large number of files under packages, it could take a little bit time to find which file in the packages cause the import cycle.
The proposal change:

package cyclic-import-example
        imports cyclic-import-example/packageA from /Users/personal/cyclic-import-example/main.go:4:5
        imports cyclic-import-example/packageB from /Users/personal/cyclic-import-example/packageA/a.go:5:2
        imports cyclic-import-example/packageA from /Users/personal/cyclic-import-example/packageB/bb.go:5:2: import cycle not allowed

The proposal here is to add line numbers after each package name in the stack info, so that developers could be easier to find which file and line import which package causes the cyclic import error, and make troubleshooting more efficient.

Happy to hear any comments!
Please feel free to add comments!

@gopherbot gopherbot added this to the Proposal milestone Jul 12, 2024
@gabyhelp
Copy link

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@xin-tsla xin-tsla changed the title proposal: iInternal/load: add more details for import cycle not allowed error proposal: Internal/load: add more details for import cycle not allowed error Jul 12, 2024
@xin-tsla xin-tsla changed the title proposal: Internal/load: add more details for import cycle not allowed error proposal: internal/load: add more details for import cycle not allowed error Jul 12, 2024
@seankhliao seankhliao changed the title proposal: internal/load: add more details for import cycle not allowed error cmd/go: add more details for import cycle not allowed error Jul 12, 2024
@seankhliao seankhliao modified the milestones: Proposal, Backlog Jul 12, 2024
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go and removed Proposal labels Jul 12, 2024
@seankhliao seankhliao changed the title cmd/go: add more details for import cycle not allowed error cmd/go: show files in import cycle errors Jul 12, 2024
@seankhliao
Copy link
Member

Duplicate of #66078

@seankhliao seankhliao marked this as a duplicate of #66078 Jul 12, 2024
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants