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!

Comment From: gabyhelp

Related Issues and Documentation

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

Comment From: seankhliao

Duplicate of #66078