4 ms·
Not sure what you mean by needing a dummy value if your function only returns success/failure. That's what a boring old error return is for. func foo() er
by NateDad 12y ago
Not sure what you mean by needing a dummy value if your function only returns success/failure. That's what a boring old error return is for.
func foo() error
- stormbrew 12y agoYes, but unlike having a second result this particular error check need not be touched. To make it so the caller has to check it, I'd have to return a dummy normal return.
- NateDad 12y agoYou can always call a function and not assign the return calls to anything. If you have func foo() (string, error) You can still call it thusly: foo() However there are tools to check for unchecked errors like this one: https://github.com/kisielk/errcheck https://github.com/kisielk/errcheck