func Foo() (err error) { defer func() { err = errors.New("some error") }() }
The function will return the "some error" error.
However, checking the return value is always a good idea, and any errors should at least be logged.
I too wish it was less cumbersome to use defer properly.