Re: [go-nuts] Need a way to check only key exist or not? without value?

2020-04-28 Thread Shishir Verma
pril 28, 2020 at 10:23:08 AM UTC+5:30, Randall O'Reilly wrote: >> >> I think map[string]struct{} takes no storage for the value and is the >> most efficient way to do this. >> >> - Randy >> >> > On Apr 27, 2020, at 7:20 PM, Shishir Verma wrote:

[go-nuts] Re: Need a way to check only key exist or not? without value?

2020-04-27 Thread Shishir Verma
I think the idiomatic way to implement a set in golang is to use a map with bool values. Here is an example from effective go documentation : attended := map[string]bool{ "Ann": true, "Joe": true, ... } if attended[person] { // will be