No methods when using map[string]interface{}?

If you create a map[string]interface{}, the methods from the original type seem to be unavailable to the values in the map. Is there a way to access the method from the original type?

See this example with time.Time and the Time method IsZero() that is unavailable.

Background is that I’m playing around with performing data processing from a CSV. The data is extracted and put in a slice of maps, rather than a slice of structs, as I want to use the column headers (from row 0) as identifiers, instead of defining struct elements.
Not sure if this is the best way to do so, however :slight_smile:

Thanks in advance!

You can use type assertions or type switches to get original type back.

1 Like

Thanks! Type assertion was indeed what I was looking for.

Solved issue in example: