Skip to content

Commit 4b21702

Browse files
committed
src/go/doc: in Examples, check for len of params.List, not nilness
This makes the check the same as the one in the tests vet check. It's safer to check the number of arguments rather than for a nil slice. Change-Id: I8e04e9c612573f334770c1c4245238649656c6e2 Reviewed-on: https://go-review.googlesource.com/c/go/+/211598 Run-TryBot: Michael Matloob <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
1 parent a5bfd9d commit 4b21702

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/go/doc/example.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func Examples(testFiles ...*ast.File) []*Example {
6262
if !ok || f.Recv != nil {
6363
continue
6464
}
65-
if params := f.Type.Params; params.List != nil {
65+
if params := f.Type.Params; len(params.List) != 0 {
6666
continue // function has params; not a valid example
6767
}
6868
numDecl++

0 commit comments

Comments
 (0)