Created
January 19, 2015 18:47
-
-
Save cuevasclemente/d530e4f5c0c3d0763120 to your computer and use it in GitHub Desktop.
eazyE: A pattern I use a lot in Go.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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