3 ms·
I did the tour, studied the spec, and read Effective Go. Don’t remember the trick of constructing a set type by way of map[<settype>]struct{} in any of them.
by everybodyknows 6y ago
I did the tour, studied the spec, and read Effective Go. Don’t remember the trick of constructing a set type by way of map[<settype>]struct{} in any of them.
https://rytisbiel.com/2021/03/06/darker-corners-of-go/#mapstruct https://rytisbiel.com/2021/03/06/darker-corners-of-go/#mapst...
- packetlost 6y agoHaving used this trick before, it's fine. You get the uniqueness property of a set, but no easy way to do set operations, so it's not necessarily that useful.