Go has a type reflection system, which allows for inspection of type at runtime.
reflect
packageimport ( "fmt" "reflect" ) func main() { var x int = 42 var y []string = []string{"hello", "world"} // Get the reflect.Type of x xType := reflect.TypeOf(x) fmt.Println("Type of x:", xType) fmt.Println("Kind of x:", xType.Kind()) // Output: Kind of x: int // Get the reflect.Type of y yType := reflect.TypeOf(y) fmt.Println("Type of y:", yType) fmt.Println("Kind of y:", yType.Kind()) // Output: Kind of y: slice }