Kind

Another important property of reflect.Type is Kind, which is an enumeration of basic types and generic complex types. The main relationship between reflect.Kind and reflect.Type is that the first represents the memory representation of the second.

For built-in types, Kind and Type are the same, but for custom types they will differ—the Type value will be what is expected, but the Kind value will be one of the built-in ones on which the custom type is defined:

func main() {
var a interface{}

a = "" // built in string
t := reflect.TypeOf(a)
fmt.Println(t.String(), t.Kind())

type A string // custom type
a = A("")
t = reflect.TypeOf(a)
fmt.Println(t.String(), t.Kind())
}

A full example is available here: https://play.golang.org/p/qjiouk88INn.

For the composite type, it will reflect just the main type and not the underlying ones. This means that a pointer to a structure or to an integer is the same kind, reflect.Pointer:

func main() {
var a interface{}

a = new(int) // int pointer
t := reflect.TypeOf(a)
fmt.Println(t.String(), t.Kind())

a = new(struct{}) // struct pointer
t = reflect.TypeOf(a)
fmt.Println(t.String(), t.Kind())
}

A full example is available here: https://play.golang.org/p/-uJjZvTuzVf.

The same reasoning applies to all the other composite types, such as arrays, slices, maps, and channels.