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 *types.Pa
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 implementati
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 th
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 typ
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 com
> 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 e
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 are