Created
July 11, 2016 10:03
-
-
Save Komosa/0b671521fa49a3f2f54b16c09419919b to your computer and use it in GitHub Desktop.
error handling in golang tests
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
func Test(t *testing.T) { | |
fatalIf := func(err error) { | |
if err != nil { | |
t.Fatal(err) | |
} | |
} | |
err := os.MkdirAll(TEST_DATA_DIR, 0700) | |
fatalIf(err) | |
// many other err = sth(); fatalIf(err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment