Antonboom / testifylint

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

blank-import: forbid import of root package `github.com/stretchr/testify` #37

Closed dolmen closed 5 months ago

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

Import of package github.com/stretchr/testify is just an error. This package contains only documentation.

I have noticed that import in multiple projects. That import was added only to workaround issues with old dependency management tools. This is obsolete in the Go modules era.

Antonboom commented 7 months ago

It could be solved by

but I'll think about adding it to the linter 🤔

dolmen commented 7 months ago

I'm also tempted to add this to the package:

func init() {
    panic("package github.com/stretchr/testify must not be imported: it has no content")
}
Antonboom commented 5 months ago

Also https://github.com/search?q=%22_+%5C%22github.com%2Fstretchr%2Ftestify%5C%22%22&type=code&p=1