On Tue, Sep 27, 2016 at 9:20 PM, Nate Finch <nate.fi...@gmail.com> wrote:
> I want to, for example, compare a Type from code I'm ingesting to see if
> it's a *bytes.Buffer ....  is there a way I can make my own Type from a
> value or type definition in my code so that I can compare the two Types?  Or
> do I have to do something ugly like comparing the String() output of the
> Type to "*bytes.Buffer" ?

I'm not clear on what you are starting with.  Can you just write
    if _, ok := v.(*bytes.Buffer); ok {
        fmt.Println("it's *bytes.Buffer")
    }

You can construct some types using, e.g., reflect.PtrTo, but you can't
construct a named type like bytes.Buffer.

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