aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/doc/testdata/pkg.go
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2015-10-23 17:09:39 -0700
committerRob Pike <r@golang.org>2015-11-17 20:51:19 +0000
commit07d48993f257a6536d83555bb8cc9daffa07dd56 (patch)
tree170590cc60babe130029b7013ae9ed6ec4675ac4 /src/cmd/doc/testdata/pkg.go
parent90e26f52c6d2012d293ebfe8d272f03462213045 (diff)
downloadgo-07d48993f257a6536d83555bb8cc9daffa07dd56.tar.xz
cmd/doc: fix strange indentation artifacts with unexported fields
The NamePos value was not being set, and would default to a value of zero. This would cause the printing logic to get confused as to where exactly to place the "Has unexported fields" string. A trivial package changes from < type A struct { A int // A B int // B // Has unexported fields. } > to < type A struct { A int // A B int // B // Has unexported fields. } > Fixes #12971 Change-Id: I53b7799a1f1c0ad7dcaddff83d9aaeb1d6b7823e Reviewed-on: https://go-review.googlesource.com/16286 Run-TryBot: Joe Tsai <joetsai@digital-static.net> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/cmd/doc/testdata/pkg.go')
-rw-r--r--src/cmd/doc/testdata/pkg.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cmd/doc/testdata/pkg.go b/src/cmd/doc/testdata/pkg.go
index 0f06651d6b..3e7acee50b 100644
--- a/src/cmd/doc/testdata/pkg.go
+++ b/src/cmd/doc/testdata/pkg.go
@@ -60,7 +60,7 @@ func internalFunc(a int) bool
// Comment about exported type.
type ExportedType struct {
// Comment before exported field.
- ExportedField int
+ ExportedField int // Comment on line with exported field.
unexportedField int // Comment on line with unexported field.
}
@@ -87,6 +87,13 @@ func ExportedTypeConstructor() *ExportedType {
const unexportedTypedConstant ExportedType = 1 // In a separate section to test -u.
+// Comment about exported interface.
+type ExportedInterface interface {
+ // Comment before exported method.
+ ExportedMethod() // Comment on line with exported method.
+ unexportedMethod() // Comment on line with unexported method.
+}
+
// Comment about unexported type.
type unexportedType int