You need to actually get the type of a *bytes.Buffer with reflect.TypeOf and compare types.
https://play.golang.org/p/iqv16ibt9w Le mercredi 28 septembre 2016 13:38:29 UTC+2, Nate Finch a écrit : > > Sorry, I wasn't clear. I'm using the go/types package to read go code and > generate wrapper code for it. And I need to generate different code based > on the types of parameters a function takes. > > So like if a function takes a *bytes.Buffer to write to and I am > generating a wrapper that wants the output written to an io.Writer, I need > to generate wrapper code that creates the buffer, passes it to the function > and then writes it to the writer output. > > So, when reading a function via go/types, it has a Parameter() Tuple, and > I can get the types.Type of each one, but I don't know how to say "Is this > types.Type a *bytes.Buffer?" > > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
