Skip to content

Commit

Permalink
Add a shorthand for AppendInvoke
Browse files Browse the repository at this point in the history
  • Loading branch information
burdiyan committed Sep 1, 2022
1 parent 80b07a7 commit e1e913f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions error.go
Expand Up @@ -660,3 +660,10 @@ func Close(closer io.Closer) Invoker {
func AppendInvoke(into *error, invoker Invoker) {
AppendInto(into, invoker.Invoke())
}

// AppendFunc is a shorthand for AppendInvoke.
// It allows using function or method value directly
// without having to wrap it into an Invoker interface.
func AppendFunc(into *error, fn func() error) {
AppendInvoke(into, Invoke(fn))
}

0 comments on commit e1e913f

Please sign in to comment.