-
-
Notifications
You must be signed in to change notification settings - Fork 398
Open
Labels
needs-decisionWe have to decide if this check is feasible and desirableWe have to decide if this check is feasible and desirablenoisy-positive
Description
We sometimes need to import a package for its side effects. For example:
import (
_ "github.com/mattn/go-sqlite3"
)However, let's say we now need to directly reference the imported package.
import (
_ "github.com/mattn/go-sqlite3"
sqlite3 "github.com/mattn/go-sqlite3"
)
// use sqlite3 hereIn this situation, staticcheck will flag the duplicate import (ST1019). But removing the underscore import would be dangerous, since if the direct use of the package is later removed, goimports will remove the import and now we have a problem.
Since this is the only legitimate reason to have duplicate imports that I can think of, it would be nice if staticcheck had some flag to ignore underscore imports for ST1019.
Metadata
Metadata
Assignees
Labels
needs-decisionWe have to decide if this check is feasible and desirableWe have to decide if this check is feasible and desirablenoisy-positive