3 ms·
Unused imports that are imported solely for side effects should be imported this way to avoid that problem: import ( _ "github.com/some/package" ) Giv
by atombender 7y ago
Unused imports that are imported solely for side effects should be imported this way to avoid that problem:
import (
_ "github.com/some/package"
)
Given that this is the only way to have unused imports with mainline Go — in other words, it's impossible to accidentally remove one once it's been declared this way — I'm not sure I see what the argument is.
- icxa 7y ago> I'm not sure I see what the argument is. That there are other reasons why unused imports are a compilation error in go, and it isn't as simple as turning them into warnings