Plus, it's super easy for other people to use. Just check out the modified source, make.bash, and you're done in less than a minute of compilation!
I may not agree with some of their philosophies, but the tooling is nice!
Plus, it's super easy for other people to use. Just check out the modified source, make.bash, and you're done in less than a minute of compilation!
I may not agree with some of their philosophies, but the tooling is nice!
Looks like you're prepping for a PR? Good luck, in earnest; the import-in-import-out dance is like adding 8 seconds to every dev cycle.
At the end of the day, it's a hair shirt. And no matter how many coping mechanisms people come up with, it's still a hair shirt.
Even the go authors had to put a limit on their madness. You'll notice that unused unexported functions don't cause compilation errors despite the fact that they, too, fall afoul of the original justification for this policy: https://golang.org/doc/faq#unused_variables_and_imports
"The presence of an unused variable may indicate a bug, while unused imports just slow down compilation, an effect that can become substantial as a program accumulates code and programmers over time. For these reasons, Go refuses to compile programs with unused variables or imports, trading short-term convenience for long-term build speed and program clarity."
But disallowing unused functions would have been a bridge too far, so we're left with this half-measure and half-reasoning that doesn't even make sense.
how would you find an unused function?
Note that I'm talking about non-exported functions (i.e. someFunction rather than SomeFunction).
> this commit will not go into mainline go
Truly unfortunate. I don't write Go, but so often I comment out large swaths of code for debugging purposes and get warnings for unused variables and imports. If I couldn't simply ignore the warnings, I would not be a happy camper. It's funny to me that people call it a "hackers language", when it seems so restricting from afar.
Same goes for exploratory programming, where I'm testing out ideas rather than writing production code. I expect my tools to get out of my way rather than play nanny.
The build flags approach is more comprehensive and safer, because it simply won't compile when you build without the -warnunused flag (for example in your ci trigger off your git repo).
You could have a flag, but we all know this is going to be abused. Seems devs have opted away from such, though it is understandably opinionated and require some thought.
This is just a solution in search of a problem.
Not against options per se, but can see the arguments against implicitly hiding alternative behaviour. Many compilers fail to be simple, performant and provide the right incentives.
Again, never had problems adding experimental code (// TODO: Remove), bootstrap-code, extra debug-info, etc. Ie. Why you should want to prefer refactoring.
const value = getMainValue() + calculateAdjustment();
const value = getMainValue() // + calculateAdjustment();
The main reason would be that they don’t actually matter and having to strip them out is a worthless pain in the ass when trying things out.