incu6us / goimports-reviser

Right imports sorting & code formatting tool (goimports alternative)
MIT License
586 stars 75 forks source link

fails on package <name>_test that imports <name> #158

Closed spikecurtis closed 3 months ago

spikecurtis commented 3 months ago

Our project includes go test files with package name foo_test in the same directory as foo, and these typically import the package to test it. goimports-reviser incorrectly thinks this is an import cycle

e.g.

agent/agent_test.go:49:2: could not import github.com/coder/coder/v2/agent (-: import cycle not allowed in test) (typecheck)
    "github.com/coder/coder/v2/agent"
    ^

from https://github.com/coder/coder/blob/d04959cea8f24da12b7936f289ab0b268880a706/agent/agent_test.go#L49

spikecurtis commented 3 months ago

Sorry, getting wires crossed with a different tool!

ccoVeille commented 3 months ago

z2smvh37sho01.jpg

https://www.reddit.com/r/ProgrammerHumor/comments/87r870/debugging/

@spikecurtis