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 <https://golang.org/doc/effective_go.html#maps>:
attended := map[string]bool{ "Ann": true, "Joe": true, ... } if attended[person] { // will be false if person is not in the map fmt.Println(person, "was at the meeting") } On Monday, 27 April 2020 22:16:20 UTC+5:30, adithya...@gmail.com wrote: > > Basically i need a slice with indexed values, so that i can check only > existence. > or a map with only keys? > 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/1201e6f3-621e-4875-9374-d7713fa7d8aa%40googlegroups.com.