Changing it will bring down the entire system.
We’ve spent ten million dollars and do not know why.
Comment on Golang be like
DarkDarkHouse@lemmy.sdf.org 1 year ago
As your future colleague wondering what the hell that variable is for, thanks Go.
Changing it will bring down the entire system.
We’ve spent ten million dollars and do not know why.
Isnt the syntax highlighting it as mever used?
So why would they wonder?
If it is a pure value, I’d assume yes, but if it is tied to a side effect (E.g. write its value to a file), then it would be not used but still could break your app if removed.
I’m not familiar with rust language specifically, but generally that’s what could happen
A quick “find all references” will point out it’s not used and can be deleted if it accidentally gets checked in but ideally, you have systems in place to not let it get checked into the main branch in the first place.
Yeah that should be looked for in a CI line check, not a compilation requirement
You mean a system like the compiler
Or a linter. Or code reviews. Or anything else. The nice thing is that if the compiler doesn’t demand something. The compiler should have the option to do it. The option could even be defaulted on. Afaik there is no way in Golang to disable that error (this is the line that does it: github.com/golang/go/blob/…/stmt.go#L67-L69). like --no-pedantics or such. Golang’s compiler openly refuses to give engineers more choices in what they think is the best system to handle it.
Yeah any compiler should support environments or confit files. Our CI would never with without –env “stage”
If only there was some way the compiler could detect unused variable declarations, and may be emit some sort of “warning”, which would be sort of like an “error”, but wouldn’t interrupt the build, and could be treated as an error in CI pipelines
Some people simply ignore warnings, that’s the main issue. Trust me, I saw this way too often.
If you cannot compile it than you have to fix it, otherwise just mark unused variables as ‘not an error’ via _ = someunusedvar
.
Willem@kutsuya.dev 1 year ago
I prefer for it to be just a warning so I can debug without trouble, the build system will just prevent me from completing the pull request with it (and any other warning).