Struct as map key
package main
import (
"fmt"
)
type Key struct {
ID int
}
func main() {
m := make(map[Key]struct{})
m[Key{132}] = struct{}{}
fmt.Printf("%#v", m)
}INFO
package main
import (
"fmt"
)
type Key struct {
ID int
}
func main() {
m := make(map[Key]struct{})
m[Key{132}] = struct{}{}
fmt.Printf("%#v", m)
}