代码在golang中做什么? [重复]

This question already has an answer here:

I tried to search this and figure out exactly how it work but I'm having trouble finding an explanation.

If i have a variable data of type interface{} (data interface{})

What would eventData := data.(map[string]interface{}) be doing? I know interface can represent a number of things, but what is a high level overview of what his happening here?

</div>

It is a type assertion:

A type assertion provides access to an interface value's underlying concrete value.

t := i.(T)

https://tour.golang.org/methods/15

If the asserion does not hold it will trigger a panic. To test if the value is of specific type T you can use this:

t, ok := i.(T)

Ok is a boolean that is true if the assertion holds and false otherwise.