Skip to content

Instantly share code, notes, and snippets.

@alassek
Created April 15, 2019 14:52
Show Gist options
  • Save alassek/3e6e9bb9604e43ff231518929df7f335 to your computer and use it in GitHub Desktop.
Save alassek/3e6e9bb9604e43ff231518929df7f335 to your computer and use it in GitHub Desktop.
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