I'm just starting out with Go, and coming from Python I'm trying to find the equivalent of a dict in Python. In Python I would do this:
d = {
'name': 'Kramer', # string
'age': 25 # int
}
I first found the map
type, but that only allows for one type of value (it can't handle both ints
and strings
. Do I really need to create a struct
whenever I want to do something like this? Or is there any type I'm missing?
All tips are welcome!