Quick actions

cmd+k|ctrl+k

Navigation

Languages

Struct as map key

Snippet info

Language

Go

Visibility

public

Author

cheshirysh

Created

2017-02-16T13:34:16Z

Updated

2017-02-16T13:34:29Z

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