When func (errs List) As(target interface{}) bool in gqlerror/error.go:100 is called, the target out argument is passed as pointer to errors.As() for each list element.
What did you expect?
To work as expected when being called from inside errors.As() and return the first instance matching the type of the target parameter, errors.As() has to be called with target, not &target.
What happened?
When
func (errs List) As(target interface{}) bool
ingqlerror/error.go:100
is called, the target out argument is passed as pointer toerrors.As()
for each list element.What did you expect?
To work as expected when being called from inside
errors.As()
and return the first instance matching the type of thetarget
parameter,errors.As()
has to be called withtarget
, not&target
.Versions
v 2.5.9
Cause
The recent commit 450a0eed introduced this bug.