@cathal Do you happen to know how to use sync.Pool with objects that require a Close()? Would a defer work inside New() for that? I feel like it wouldn't work because defer executes when current scope is exited, and New() is almost immediately exited...
@gargron I haven't used sync.Pool much at all, but my memory tells me that items are usually left in the pool as they were last time they were used. So you would have to erase/overwrite fields prior to, or just after, using them. If a "close" method is required after each use then it sounds like a poor candidate for a Pool, so I'm not really sure where to follow that.
It's been a while since I coded in Go, sorry that's not more useful