On Mon, Apr 27, 2020 at 10:46 AM <adithyasasha...@gmail.com> wrote: > > Basically i need a slice with indexed values, so that i can check only > existence. > or a map with only keys?
Use a map with struct{} values: m:=make(map[keyType]struct{}) Then you can add keys by: m[key]=struct{}{} and check existence using: _,exists:=m[key] > How it can be done? > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/30e31603-3a24-405a-908d-0706c3b1a851%40googlegroups.com. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAMV2RqqD7RvauM23oL6mnC%2B3Gt4zvxpZ_ds4Rhdt7y41dnspaQ%40mail.gmail.com.