Skip to content

Instantly share code, notes, and snippets.

@cuevasclemente
Created January 19, 2015 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuevasclemente/d530e4f5c0c3d0763120 to your computer and use it in GitHub Desktop.
Save cuevasclemente/d530e4f5c0c3d0763120 to your computer and use it in GitHub Desktop.
eazyE: A pattern I use a lot in Go.
// eazyE is a simple syrup for error checking. It is a pattern I use often enough,
// so I decided to make a quick library out of it.
package eazyE
import (
"fmt"
"log"
)
func New(s string, err error) (fErr error) {
if err != nil {
fErr = fmt.Errorf(s, err)
return
}
return
}
func Newl(s string, err error) {
if err != nil {
log.Println(fmt.Errorf(s, err))
return
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment