Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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