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 implementation of the error interface and
instantiate one of those?





On Sat, Dec 14, 2019 at 1:07 AM Dan Kortschak <d...@kortschak.io> 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 than by
> using NewInterfaceType, NewFunc and NewSignature functions (I am
> assuming that the nil *types.Package is what should be used for the
> call to NewFunc).
>
> thanks
> Dan
>
> --
> 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/4fb681518e2e36e0d0564394546dd7879dd8f96a.camel%40kortschak.io
> .
>

-- 
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/CA%2Bv29Lt2OX7CAqDnLy5-ABtjMPNPNFE22nRM9FikcFmJxRr7Uw%40mail.gmail.com.

Reply via email to