aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2012-01-14 11:57:32 -0800
committerRob Pike <r@golang.org>2012-01-14 11:57:32 -0800
commit2374edc6401401fcaa0d328bab38c9e3cffc9274 (patch)
treeee0eeb755915f5fa1c2e32bb5d6a6f326b18cd9a
parent4cfa9e3c616ee9ffd688adc7caffa76bfd7ee312 (diff)
downloadgo-2374edc6401401fcaa0d328bab38c9e3cffc9274.tar.gz
go-2374edc6401401fcaa0d328bab38c9e3cffc9274.zip
go/doc: print only one newline between paragraphs
Fixes #2595. R=golang-dev, gri CC=golang-dev https://golang.org/cl/5544068
-rw-r--r--src/pkg/go/doc/comment.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/pkg/go/doc/comment.go b/src/pkg/go/doc/comment.go
index 14809fec91..060e37bff1 100644
--- a/src/pkg/go/doc/comment.go
+++ b/src/pkg/go/doc/comment.go
@@ -353,12 +353,10 @@ func ToText(w io.Writer, text string, indent, preIndent string, width int) {
width: width,
indent: indent,
}
- for i, b := range blocks(text) {
+ for _, b := range blocks(text) {
switch b.op {
case opPara:
- if i > 0 {
- w.Write(nl)
- }
+ // l.write will add leading newline if required
for _, line := range b.lines {
l.write(line)
}