On Sat, Aug 15, 2020 at 3:45 PM 'Dan Kortschak' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> I would like to be able to obtain the original type for an alias given
> a source input. I can see in "go/types" that it's possible to know
> whether a named type is an alias by `typ.Obj().IsAlias()`, but I cannot
> see how to obtain the actual original type unless it is an alias for a
> basic type.
>
> Can someone point me to a way to get this information? From the source
> it looks something like `typ.Obj().Type().(*types.Named).Obj().Type()`.
> Is this correct assuming that the original type is a named type?

I haven't tested it but I *think* you can just write typ.Underlying().

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWK5VcOvHm%3DuZ0vHWw7_NCkGK4km2YrwBMTs2LY5d1VfQ%40mail.gmail.com.

Reply via email to