errors.As function when the second argument is not a pointer to an interface or to a type that
implements an error.
Such calls panic at runtime.
For more information about the As function, refer to func As at go.dev.
Example:
_, err := os.Open("non-existing")
var pathError *fs.PathError
if errors.As(err, pathError) { // a pointer to *fs.PathError is required
}
After the Prepend '&' quick-fix is applied:
_, err := os.Open("non-existing")
var pathError *fs.PathError
if errors.As(err, &pathError) {
}
This inspection only reports if the language version is 1.13 or higher.