News for hackers. Stuff that matters.
Re:Map[string]interface{} in Go: a user's manual by nynx on Monday July 26, 2021 @02:56PM (#27963666)
In rust, hashsets are just hashmaps with a zero-sized type as the value, which results in all the extra getting optimized away.
Re:Map[string]interface{} in Go: a user's manual by BenTheElder on Monday July 26, 2021 @03:02PM (#27963773)
A zero-sized type + hashmap for sets is also done in Go with a `struct{}`. [1][2]

But without generics it must be implemented again for each entry type ...

Kubernetes uses a code generator to automate this, but it's a bit kludge. [3]

[1]: https://pkg.go.dev/k8s.io/apimachinery/pkg/util/sets#Empty

[2]: https://dave.cheney.net/2014/03/25/the-empty-struct

[3]: https://github.com/kubernetes/code-generator/blob/master/cmd...