On Tue, Jul 26, 2016 at 6:35 AM, Dave Cheney <d...@cheney.net> wrote: > If saving one byte per entry is important for your application, the latter is > your choice. The former has nicer properties that you can use the single > value form of map access, > > if m[key] { > // found > } > > I'd say the former is the right choice for 97.25% of general use cases.
I'd agree with this, except that I don't trust that one guy in the office not to sneak past something that somehow puts a false in the map and causes bugs later. Arguably that's a review problem, but even so one or two extra bytes of code (`_, ok = m[key]; ok') seems like a small price to pay for safety guarantees and to save a few bytes of memory. (though as you said, it hardly matters either way; I just prefer to recommend the struct{} version to new people) —Sam -- Sam Whited pub 4096R/54083AE104EA7AD3 -- 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.