3 ms·
The main issue is none of these though, it's that Go's DCE is generally quite bad so any package you import will lead to significant increases in binary size.
by masklinn 5y ago
The main issue is none of these though, it's that Go's DCE is generally quite bad so any package you import will lead to significant increases in binary size.
`fmt` is (or was) a big one in every sense of the word, and why using the `print` and `println` builtin functions was sometimes a workaround (probably still is): a few years back, converting a `fmt.Print` call to `print` would save you a cool megabyte (if that was the only cause for importing fmt obviously).
I've always expected that was a major reason for the Go compiler being so anal about unused import, it's essentially making the user perform DCE.
- imoverclocked 5y agoExactly, if it’s not enforced, people often neglect it. As projects grow, so do unnecessary dependencies.