I will not, and neither should you.
Reading
if err := doSmth(); err != nil {
return err
}
Is just so much less magical than reading
try(doSmth())
And, anyways, the best way would be to write
if err := doSmth(); err != nil {
return fmt.Errorf("fizzing the buzz: %v", err)
}
If you are really concerned about writing speed and use vim-go you can always add this to your vimrc:
autocmd FileType go iabbrev try <Esc>:GoIfErr<CR>i
Result:
I’m sure most modern IDEs allow you to do something similar, so please do 😊.