Created
April 23, 2019 19:01
-
-
Save jacoelho/3c7935a3f196c582d06f5c17f7305575 to your computer and use it in GitHub Desktop.
immutable errors
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 characters
package main | |
import ( | |
"fmt" | |
) | |
type Error string | |
func (e Error) Error() string { return string(e) } | |
const ( | |
ErrFoo = Error("foo") | |
) | |
func main() { | |
fmt.Println(ErrFoo) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment