Golang does not have built it sets.
Basic functionality can be mimicked using maps with empty
Another option is to use a Boolean value, but empty struct does not use any space and therefore more efficient. Another benefit of empty struct is that Boolean value can be set to
false, which could be confusing in cases where we just want to check for key existence in a set (regardless of it’s value).
Bellow is a working basic implementation, you can also see it in Go Playground: https://play.golang.org/p/Lk63G8gNN_t.