Ask HN: Are compiler errors for unused code necessary?

2 pointsposted 11 hours ago
by qwool

Item id: 47054353

3 Comments

dabinat

10 hours ago

It can be useful at letting you know of things that might be bugs. Like maybe you intended to use x in a calculation but forgot. Or maybe you intended to call func2() but actually called func1() instead. I feel like it should be a warning more than a hard error though.

mboon

10 hours ago

A lot of users including myself run 'go build...' and execute the binary in development. It is recommended by systems file watching services like air.

I think the flag works fine as a solution.

PaulHoule

10 hours ago

I hate dead code. So many times I've spent two days understanding and maintaining some code and found that one of those days was wasted.