News for hackers. Stuff that matters.
Re:Tom Duff: Reading Code From Top to Bottom (1999) by enneff on Sunday June 05, 2011 @04:34AM (#2621643)
Go's defer feature, combined with named return values, lets you do this:

    func someFunction(b bool) (i int) {
        defer func() {
            log.Printf("I'm returning %d", i)
        }()
        if b {
            return 1
        }
        return 0
    }
For more on defer, see this blog post: http://blog.golang.org/2010/08/defer-panic-and-recover.html

There are no comments on this comment yet.