Antonboom / testifylint

The Golang linter that checks usage of github.com/stretchr/testify.
https://github.com/stretchr/testify
MIT License
98 stars 9 forks source link

feature: forbid import of testify packages as `_` #38

Closed dolmen closed 8 months ago

dolmen commented 10 months ago
import _ "github.com/stretchr/testify/assert"

Import of testify packages (assert, require, suite, mock, http) as _ is useless: those package don't do init magic.

They might have been imported like that in the past to workaround issues in dependency management tools (see the related case #37) but, now, in the Go modules era, this is obsolete.

Here are some cases in the wild:

hendrywiranto commented 9 months ago

may I take this if this feature is desired?

Antonboom commented 9 months ago

@hendrywiranto, yes

it looks like enabled by default checkers.AdvancedChecker feel free to ask questions :)