This is a creation in Article, where the information may have evolved or changed.
Golang in the map, the key can be many types, such as bool, number, string, pointer, channel, and only contains the previous types of interface types, structs, arrays
Obviously, slice, map and function are not allowed, because these can not use = = to judge
The original text reads as follows:
As mentioned earlier, map keys is comparable. The language spec defines this precisely, but in short, comparable types is Boolean, numeric, string, pointer, channel, a nd interface types, and structs or arrays that contain only those types. Notably absent from the list is slices, maps, and functions; These types cannot is compared using == , and May is not used as map keys.
The two structs are exactly equal, meaning that the values of all the variables inside are exactly equal, and the examples in the original text are as follows:
Type Key struct { Path, country string}hits: = Make (Map[key]int)