by drvd · 5y ago · 0 comments
I'm sorry to hurt your feelings, but compiler definitely can know whether some external module is used in the file it's compiling now.
See my other comment: https://news.ycombinator.com/item?id=26553401
Without opening more files and parsing them, how does it know that none of the transitive dependency tree has a `func init(){}` ?
Go forces you to add an underscore if you mean "I'm importing this for its side-effects, and am not using it directly".