cmd/vet: %s is valid for an array of stringer
vet was quiet for []stringer, but not for [N]stringer. The source of the problem was how the recursive call used .Elem().Underlying() for arrays, but .Elem() for slices. In the first case, the named type is dropped, thus losing all information of attached methods. Be consistent across slices and arrays, by dropping the Underlying call that is causing trouble. Add regression tests too, including cases where the element type does not implement fmt.Stringer. Fixes #23552. Change-Id: I0fde07d101f112d5768be0a79207ef0b3dc45f2e Reviewed-on: https://go-review.googlesource.com/90455 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:Ian Lance Taylor <iant@golang.org> Reviewed-by:
Rob Pike <r@golang.org>
Showing
Please register or sign in to comment