importas icon indicating copy to clipboard operation
importas copied to clipboard

versioned package imports

Open shaneHowearth opened this issue 6 months ago • 0 comments

When importing version 2 or above of a Go module there's a bit of problem with imports that needs clarifying.

https://go.dev/blog/v2-go-modules

If I have

import (
   foo "github.com/example/foo/v2"
)

The alias is flagged because the package and the path are not matching , that is foo andv2 are clearly not the same.

foov2 doesn't match either

v2 on its own isn't a good package alias.

Is there a nicer way (instead of listing exclusions in the config) of 'fixing' this?

shaneHowearth avatar Apr 30 '25 22:04 shaneHowearth