Re: [go-nuts] types lookup for error interface type

2019-12-14 Thread Dan Kortschak
I think you are right. Thanks. On Sat, 2019-12-14 at 19:20 +, Paul Jolly wrote: > > This seem massively over complicated, so I'm wondering if there is > > an > > easier way. > > I think you're after types.Universe.Lookup("error")? > > > Paul > -- You received this message because you

Re: [go-nuts] types lookup for error interface type

2019-12-14 Thread Paul Jolly
> This seem massively over complicated, so I'm wondering if there is an > easier way. I think you're after types.Universe.Lookup("error")? Paul -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] types lookup for error interface type

2019-12-14 Thread Dan Kortschak
I think I must have asked this really badly. I don't want a reflect.Type of an error, I want a types.Type representation of error for performing static analysis. The playground that I imagine is necessary is something like this. https://play.golang.org/p/e-FU0_4J9jK This seem massively over

Re: [go-nuts] types lookup for error interface type

2019-12-14 Thread 'Axel Wagner' via golang-nuts
https://play.golang.org/p/pdjKMn__ufA On Sat, Dec 14, 2019 at 10:07 AM Dan Kortschak wrote: > In the go/types package there is an easy way to obtain a types.Type for > basic builtin types. This doesn't exist for the error type. > > Is there an easier way to get a types.Type representing error

Re: [go-nuts] types lookup for error interface type

2019-12-14 Thread 'Axel Wagner' via golang-nuts
whoops, I misread :) types.Type,, not reflect :) On Sat, Dec 14, 2019 at 6:54 PM Axel Wagner wrote: > https://play.golang.org/p/pdjKMn__ufA > > On Sat, Dec 14, 2019 at 10:07 AM Dan Kortschak wrote: > >> In the go/types package there is an easy way to obtain a types.Type for >> basic builtin

Re: [go-nuts] types lookup for error interface type

2019-12-14 Thread Marcin Romaszewicz
Error is an interface, so its type depends on the implementation satisfying that interface. You can't just create an "error", since they don't exist, all that exists are implementation satisfying the error interface. That's what you're doing with NewSignature. Could you just create an

[go-nuts] types lookup for error interface type

2019-12-14 Thread Dan Kortschak
In the go/types package there is an easy way to obtain a types.Type for basic builtin types. This doesn't exist for the error type. Is there an easier way to get a types.Type representing error than by using NewInterfaceType, NewFunc and NewSignature functions (I am assuming that the nil