Commit 572329ef authored by go101's avatar go101 Committed by Robert Griesemer

go/ast: break out after first variable in ExampleCommentMap

The current ExampleCommentMap might panic if there are more satisfied
comments in the parsed program.

Change-Id: Ibe6943470aa0cfb450dae9fc07c1199acaabef73
GitHub-Last-Rev: c79e98c2868179ea47618b296ce28c5eebc0b99d
GitHub-Pull-Request: golang/go#28587
Reviewed-on: https://go-review.googlesource.com/c/147359
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent 20930c76
......@@ -176,6 +176,7 @@ func main() {
if gen, ok := decl.(*ast.GenDecl); ok && gen.Tok == token.VAR {
copy(f.Decls[i:], f.Decls[i+1:])
f.Decls = f.Decls[:len(f.Decls)-1]
break
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment