5 ms·
The unused imports thing seems to be a common complaint, however I just use go-imports, and imports are added/removed automatically when I save the file. I nev
by cpuguy83 12y ago
The unused imports thing seems to be a common complaint, however I just use go-imports, and imports are added/removed automatically when I save the file.
I never ever have to even touch imports, except sometimes when two different packages have the same name.
- ewillbefull 12y agoThis doesn't help with unused variables, which comes up just as often when doing the same thing (coding piecemeal, testing if it compiles, etc.)
- Laremere 12y agovar x int _ = x Mildly annoying, but it avoids unused variables in any code which compiles, and is a helpful reminder of "I was going to do something with this value".
- tatterdemalion 12y agoIt seems like a warning only lint would be less annoying and a better reminder.
- sukilot 12y agoIt is an established fact that humans cannot be trusted to handle warnings responsibly.
- anon1385 12y agoJudging from this thread Go users are regularly using various tricks and hacks to avoid the compiler errors. So evidently Go programmers can't be trusted to handle compiler errors responsibly and not use hacks to hide them. In which case, what is the point of making in an error? It just makes things more difficult for the responsible programmers who don't ignore warnings (instead of a warning that they will notice they have to find and remove an obscure line of code). It was an interesting experiment to make these things errors only, but it's clear that it has failed.
- im3w1l 12y agoI wonder if we can fix the "warnings ui" somehow, so that they work better. The fundamental tension seems to be that programmer thinks he knows what he is doing, adds a warning override and the warning goes away. But then it may turn out that he didn't and the warning indicated a real problem. The problem is the S/N of warnings. Our programmer removed a warning so that real warnings wouldn't drown in a see of false warnings. The question is then, can we have our cake and eat it too? We don't want to completely forget about low risk warnings, we just almost completely. Maybe we could have some kind of exponential backoff when you ignore warnings?
- cpuguy83 12y agoWhy not use a comment?
- BinaryIdiot 12y agoOh that's handy; I wish there was a flag so it could do that during compilation so I'd never have to worry about it again :)