aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2015-05-15 13:30:42 -0700
committerRob Pike <r@golang.org>2015-05-18 19:32:14 +0000
commit6f7b4e893871775b74e57d5d048ff0565d32ef79 (patch)
treeeafbe68465d5cee337b7cdbc1466f3006103df4b /src/cmd
parent362a40e37da849696e1af6874d0d5f1275a1a386 (diff)
downloadgo-6f7b4e893871775b74e57d5d048ff0565d32ef79.tar.xz
cmd/doc: put blank lines around comment for types, etc.
Better layout. Fixes #10859. The issue suggests rearranging so the comment comes out after the methods. I tried this and it looks good but it is less useful, since the stuff you're probably looking for - the methods - are scrolled away by the comment. The most important information should be last because that leaves it on your screen after the print if the output is long. Change-Id: I560f992601ccbe2293c347fa1b1018a3f5346c82 Reviewed-on: https://go-review.googlesource.com/10160 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/doc/pkg.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/doc/pkg.go b/src/cmd/doc/pkg.go
index ed4b0b82db..5c8976b663 100644
--- a/src/cmd/doc/pkg.go
+++ b/src/cmd/doc/pkg.go
@@ -115,7 +115,7 @@ func (pkg *Package) emit(comment string, node ast.Node) {
log.Fatal(err)
}
if comment != "" {
- pkg.newlines(1)
+ pkg.newlines(2) // Guarantee blank line before comment.
doc.ToText(&pkg.buf, comment, " ", "\t", 80)
}
pkg.newlines(1)
@@ -352,6 +352,9 @@ func (pkg *Package) symbolDoc(symbol string) {
}
pkg.emit(typ.Doc, decl)
// Show associated methods, constants, etc.
+ if len(typ.Consts) > 0 || len(typ.Vars) > 0 || len(typ.Funcs) > 0 || len(typ.Methods) > 0 {
+ pkg.Printf("\n")
+ }
pkg.valueSummary(typ.Consts)
pkg.valueSummary(typ.Vars)
pkg.funcSummary(typ.Funcs)