Skip to content

Instantly share code, notes, and snippets.

@jacoelho
Created April 23, 2019 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacoelho/3c7935a3f196c582d06f5c17f7305575 to your computer and use it in GitHub Desktop.
Save jacoelho/3c7935a3f196c582d06f5c17f7305575 to your computer and use it in GitHub Desktop.
immutable errors
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