Allow passing more concrete types for any

Yeah, this happens because Go doesn’t allow implicit conversion of concrete return types to any. You’ll need to explicitly wrap the function call.

One way to adjust Wrap is to use generics:

func Wrap[T any](fn func() (T, error)) func() string {
	return func() string {
		d, err := fn()
		if err != nil {
			return err.Error()
		}
		return fmt.Sprint(d)
	}
}

This should let you use Wrap(foo) and Wrap(bar) without needing the extra wrapper function.