3 ms·
Oh good it's not just me... found it very annoying that the Go compiler complains of unused variables!
by anentropic 13y ago
Oh good it's not just me... found it very annoying that the Go compiler complains of unused variables!
- sandGorgon 13y agoArent there people (like me) who will pay good money for a version of the Go compiler without that check ? Does anyone know if I can disable it in the source code somehow and build a Go compiler (I doubt it though - if Go was never built with things like deadcode optimization because of this enforcement)
- nutate 13y agoI found it a bit of a restriction, but ideally I'm not shipping code with unused variables, so why put them in. In the worst case I'd viciously comment things out, then uncomment them and add them back where I'd deleted once I figured out what the problem was.
- sandGorgon 13y agoIf you chart out a software project from "blank file" to "write one line - code review by 8 people before merge", then Go is suited to the latter. I find myself writing a lot of malleable code when I'm prototyping and Go is really getting my way. I dont dispute it is really useful (I worked for 6 years writing C, so I know about traps) but I really, really, really wish they would put a command line option to disable it.
- edwinnathaniel 13y agoMy IDE (IntelliJ or Eclipse) will remove unused variables when I save the file. Very very handy...
- anonymoushn 13y agoYou could build this by just removing the symbols that would trigger the check, either in a modified compiler or in a preprocessor. Go is pretty easy to parse so you should have an easy time of it. If you want your unused symbols, you could insert "_ = unusedSymbol" instead.