Created
April 15, 2019 14:52
-
-
Save alassek/3e6e9bb9604e43ff231518929df7f335 to your computer and use it in GitHub Desktop.
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
type Maybedoer struct { | |
err error | |
} | |
func (m Maybedoer) Maybe(f func() error) { | |
if m.err == nil { | |
c.err = f() | |
} | |
} | |
func (m Mayberdoer) Do(f func() error) { | |
m.err = f() | |
} | |
func (m Maybedoer) Error() error { | |
return m.err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment