structの名前を取得する
解決
func getType(myvar interface{}) { valueOf := reflect.ValueOf(myvar) if valueOf.Type().Kind() == reflect.Ptr { fmt.Println(reflect.Indirect(valueOf).Type().Name()) } else { fmt.Println(valueOf.Type().Name()) } } using reflection in Go to get the name of a struct - Stack Overflow
This post is licensed under CC BY 4.0 by the author.