incu6us / goimports-reviser

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

import that contains project name inside (not starts from it) moves to project group #146

Open graarh opened 11 months ago

graarh commented 11 months ago

For example, this imports list

import (
    "context"
    ThisIsWrong "github.com/test"
    "test/abc"
    "github.com/something"
)

with project name "test" will be sorted to

import (
    "context"

    ThisIsWrong "github.com/test"
    "test/abc"

    "github.com/something"
)

and should be sorted to

    "context"

    "test/abc"

    "github.com/something"
    ThisIsWrong "github.com/test"

Check /reviser/file.go#L205. It should be HasPrefix, not Contains.