luan / vimfiles

The Vim Configuration. Uses vim-plug to manage plugins.
172 stars 58 forks source link

Introduce the `iferr` golang snippet #125

Closed danail-branekov closed 6 years ago

danail-branekov commented 6 years ago

Golang developers often have to check for errors and handle them appropriately. Writing code similar to

if err != nil {
// do something fancy here
}

is very common and therefore it would be great to have a shortcut for that.

There are some error handling snippets existing here but I don't really feel them to be "general purpose" as they are doing something concrete to handle the error (e.g. panic, log, fail a test)