News for hackers. Stuff that matters.
Re:Golang landmines by amscanne on Sunday September 18, 2016 @03:58AM (#12524366)
With named return values, the defer can modify them. For example:

func Foo() (err error) { defer func() { err = errors.New("some error") }() }

The function will return the "some error" error.

There are no comments on this comment yet.