Re:Sub-millisecond GC pauses in Go 1.8
by Matthias247 on Saturday October 29, 2016 @05:18AM
(#12823249)
That's because single error instances are much cheaper than always creating a new instance of a given type. No need to create garbage for lots of common errors. Of course you could have a dedicated type plus a singleton implementation of it in Go. But what would be the advantage? Checking if err.(type) == io.EofType does not give you more information the only checking if err == io.Eof, as long as you don't store any error instance related information in it. Which makes sense for custom errors and which Go absolutely allows you to do.
[ Parent
| on HN ]
There are no comments on this comment yet.