Thank you, I understand

在 2018年3月6日星期二 UTC+8上午2:51:39,Ian Lance Taylor写道:
>
> On Mon, Mar 5, 2018 at 1:35 AM, He Liu <he....@danoonetworks.com 
> <javascript:>> wrote: 
> > 
> > package main 
> > 
> > 
> > import ( 
> > 
> > "log" 
> > 
> > "reflect" 
> > 
> > ) 
> > 
> > 
> > type AAA = int 
> > 
> > 
> > func main() { 
> > 
> > var a AAA = 5 
> > 
> > x := reflect.TypeOf(a) 
> > 
> > log.Println(x.Name()) 
> > 
> > // print int 
> > 
> > } 
> > 
> > 
> > How to get AAA ??? 
>
> You can't.  A type alias is just another name for a type.  It doesn't 
> replace the type's real name.  Type aliases only appear at compile 
> time, not at run time.  If you need the name of a type at run time, 
> you have to use a real type definition, not a type alias. 
>
> Ian 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to