2 ms·
I've found in some cases Go's style of error handling can actually make for great documentation: when every third line of code is something like if err != ni
by logicchains 12y ago
I've found in some cases Go's style of error handling can actually make for great documentation: when every third line of code is something like
if err != nil{
log.Printf("This specific operation %v went
wrong because input %v was %v or was expected to be %v but
wasn't", operationName, inputName, actualInput,
expectedInput)
}
Then reading the error messages gives a pretty good idea of what's supposed to be happening at that point in the code.