Created
August 16, 2016 22:21
-
-
Save jnericks/388d5693262f5b313b51fa4d1195fa2c to your computer and use it in GitHub Desktop.
Revisions
-
jnericks created this gist
Aug 16, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ package main import "fmt" // Errors allows you to compose multiple errors type Errors []error func (e Errors) Error() string { if len(e) == 1 { return e[0].Error() } msg := "multiple errors:" for i, err := range e { msg = fmt.Sprintf("%s\n\t%2d: %s", msg, i, err.Error()) } return msg }