-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
I have code that implements a more advanced error model which is passed around as its own interface rather than error (which it does, implement). The code:
https://github.com/hexdigest/gowrap/blob/master/generator/types.go#L95
Dees not do an error interface check and therefore does not work for anything except a literal error type. A proper type check would look something like:
var paramType ast.Type
types.Implements(paramType, ErrorInterface)where:
// ErrorInterface defines the error interface as a type for comparison.
var ErrorInterface = types.NewInterfaceType([]*types.Func{
types.NewFunc(
0,
nil,
"Error",
types.NewSignatureType(nil, nil, nil, nil,
types.NewTuple(types.NewVar(0, nil, "", types.Typ[types.String])),
false)),
}, nil)Unfortunately this would require a much larger re-writing of the existing code so I'm only filing an issue instead of a fix :(.
Metadata
Metadata
Assignees
Labels
No labels