can i create in golang a map with any key type and any value type ? , something like :
dict1 := map[interface]interface{}
Thanks a lot !
can i create in golang a map with any key type and any value type ? , something like :
dict1 := map[interface]interface{}
Thanks a lot !
From the language spec for the key type:
So most types can be used as a key type, however:
and thus cannot be used as a map-key.
The value type can be any or (
any
orinterface{}
) type.https://go.dev/play/p/OX_utGp8nfH