danhab99@programming.dev to Golang@programming.devEnglish · 1 year agoI kinda wish there was a better way to do if err != nil in gogithub.comexternal-linkmessage-square9fedilinkarrow-up111arrow-down16file-text
arrow-up15arrow-down1external-linkI kinda wish there was a better way to do if err != nil in gogithub.comdanhab99@programming.dev to Golang@programming.devEnglish · 1 year agomessage-square9fedilinkfile-text
minus-squaredbx12@programming.devlinkfedilinkarrow-up1arrow-down5·1 year agoI too consider that if err != nil a bit complicated to type. Most times, I wrap it away in a function like your Check0. I know that the major “framework” for command line applications (cobra) has a similar logic with its checkError function.
I too consider that
if err != nil
a bit complicated to type. Most times, I wrap it away in a function like yourCheck0
. I know that the major “framework” for command line applications (cobra) has a similar logic with itscheckError
function.