I would like to log a function's return values. The "smartest" thing I could come up with is wrapping my actual function body in a closure.
func foo(a int, b int) (int, error) {
c, err := func (a int, b int) (int, error) {
//...
return c, err
}(a, b)
fmt.Printf("%v %v %v %v", a, b, c, err)
return c, err
}
Is there a way to accomplish this with less boilerplate?