2 ms·
go vet catches that scenario and won’t pass CI. You have to explicitly decide to ignore it by using an underscore for the err value and then you get just what y
by schrodinger 7y ago
go vet catches that scenario and won’t pass CI. You have to explicitly decide to ignore it by using an underscore for the err value and then you get just what you asked for.
- KirinDave 7y agoSure, but it doesn't catch the case where you have multiple error variables in scope and you refer to the wrong one in one place but not the other or if you reuse an error. I've seen that happen more than a few times. Some of it in new production code.
- apta 7y agofmt.Println says otherwise. That and it's possible to overwrite previous error variables, something that is not possible with exceptions.