Heyo, I'm wondering whether there's any official preference between the following two approaches for implementing a set (of, e.g., strings) in go:
greetings := map[string]bool { "hi": true, "hello": true, } greetings := map[string]struct{} { "hi": {}, "hello": {}, } Effective Go <https://golang.org/doc/effective_go.html#maps> suggests the former: "A set can be implemented as a map with value type bool. Set the map entry > to true to put the value in the set, and then test it by simple indexing." But the latter appears to be more memory efficient, and I've seen both in practice. Thanks! Brendan -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.