Hacker News new | ask | show | jobs
by yencabulator 1465 days ago
Parent means

    var bestShape atomic.Value
    bestShape.Store((*Circle)(nil))
1 comments

Which will store it as a *Circle, and only allow more *Circles, not Shapes. That part of GP’s claim is correct.

It just had nothing to do with atomicity; it means something specific, not just “I like the failure mode.”

That's pretty easy to workaround:

    type shapeContainer struct { Shape }
The usual way to use atomic.Value is by writing strongly-typed wrappers anyway, so that doesn't affect your codebase beyond about 3 lines.