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-square10fedilinkarrow-up111arrow-down15file-text
arrow-up16arrow-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-square10fedilinkfile-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.