I use the reflection package to check the type of my variables. For example, if I want to check if var is an integer:
reflect.TypeOf(var).Kind == reflect.Int
How to check if my variable is part of int or float?
I only see Slice as one of the types returned by Kind (), but this slice can be of any type
source
share