Golangci-lint does not detect gomega/ginko packages imported as

Hi all,

running golangci-lint run I get a ton of typecheck errors, because it cannot find (or does not read them) the ginko/gomega packages.

These gomega packages are imported as . ".........../gomega"

What to do, any ideas ?

Are those dots there literally? Or did you put them there as a matter of simplification/obfuscation?

obviously I placed them there to simplify the example. Anything from gomega, or any package imported with a dot, is not being recognized by golangci-lint

So it is missing a rule to tell you to not use . "foo/bar" imports?

Perhaps suggest adding that rule there

I want to use dot imports, but I also want my linter to be able to detect them. And it did detect them just fine up until 1 week ago when I updated my go version to go 1.18.

If this worked before, then this is clearly a bug that shöuld be reported.

Do you have this problem only with dot-imports or with any aliased import?

Though IIRC, golangci-lint is a “meta” linter, that orchestrates a bunch of other linters, you might need to selectively report upstream to only those used linters that are affected.

I have figured it out: by commenting out each enabled linter, two of them were causing the issue. So my linter config is just like before, with two linters removed.

reopening thread:

go 1.19
golangci-lint has version 1.50.1 built from 8926a95f

With these two, all important linters (that use typecheck) will fail, as they do not scan/detect imported packages. Commenting them out and leaving just a very small subset of linters is not a solution.

What am I doing wrong ? I ran go mod tidy before each run, it did not help.