5 ms·
No, it doesn't in this case. The multiple return values make it impossible to accidentally ignore an error.
by ori_b 17y ago
No, it doesn't in this case. The multiple return values make it impossible to accidentally ignore an error.
- d0mine 17y agoIt requires at least 3 lines for every function call unless you ignore errors. Exceptions allow you to catch them without boiler-plate for each function. if result, ok := func(arg); !ok { // handle error } // process result ..other stuff On the other hand channels & goroutines allow in principle less verbose mode at the cost of additional parameter to every function in a stack. errors := make(chan Error) go handle_errors(errors) // read from errors // ... result := func(arg, errors) // write to errors in case of an error // process result ..other stuff
- deleted 17y ago[deleted]