The analyzer has detected a type assertion that can never succeed because both interfaces contain a method with the same name but different signatures.
The example:
type Validator interface {
Validate() error
}
type ContextValidator interface {
Validate(map[string]string) error
}
func check(v Validator) {
....
if cv, ok = v.(ContextValidator); ok {
....
}
....
}
In the example, the v.(ContextValidator) assertion cannot be true because the Validate method has different signatures in the Validator and ContextValidator interfaces.
Such a type assertion would only make sense if the signatures of the Validate method are identical:
type Validator interface {
Validate() error
}
type ContextValidator interface {
Validate() error
}
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: