@lupyuen you might want to use the

x, ok := y.(type)
if !ok {
return fmt.Errorf("type assertion failed for: %v", x)
}

style of type assertions. by using the form with two return values you can prevent panics and instead return an error if you have malformed input data.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.