From 4e99ed6fef28bc263ec42e63fd717a13367fb659 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Fri, 18 Sep 2015 14:53:33 -0700 Subject: cmd/doc: don't drop const/var block if first entry is unexported The code assumed that if the first entry was unexported, all the entries were. The fix is simple: delete a bunch of code. Fixes #12286. Change-Id: Icb09274e99ce97df4d8bddbe59d17a5c0622e4c6 Reviewed-on: https://go-review.googlesource.com/14780 Reviewed-by: Andrew Gerrand --- src/cmd/doc/doc_test.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/cmd/doc/doc_test.go') diff --git a/src/cmd/doc/doc_test.go b/src/cmd/doc/doc_test.go index b97cc7688d..b3b0f606cd 100644 --- a/src/cmd/doc/doc_test.go +++ b/src/cmd/doc/doc_test.go @@ -54,6 +54,7 @@ var tests = []test{ `Package comment`, `const ExportedConstant = 1`, // Simple constant. `const ConstOne = 1`, // First entry in constant block. + `const ConstFive ...`, // From block starting with unexported constant. `var ExportedVariable = 1`, // Simple variable. `var VarOne = 1`, // First entry in variable block. `func ExportedFunc\(a int\) bool`, // Function. @@ -73,6 +74,7 @@ var tests = []test{ `Comment before VarOne`, // No comment for first entry in variable block. `ConstTwo = 2`, // No second entry in constant block. `VarTwo = 2`, // No second entry in variable block. + `VarFive = 5`, // From block starting with unexported variable. `type unexportedType`, // No unexported type. `unexportedTypedConstant`, // No unexported typed constant. `Field`, // No fields. -- cgit v1.3