Hacker News new | ask | show | jobs
by aktau 4373 days ago
With defers and named return values, it is actually possible to alter the return value inside of a defer. I had to do this recently to properly log an error (to abort in the calling code). Also to do with database operations of course:

https://github.com/aktau/gomig/blob/a63d309848907a72782dd94e...

It's not the prettiest, but I needed it fixed soon. Will refactor later :).

Read about it here as well: http://blog.golang.org/defer-panic-and-recover