1
0
mirror of https://github.com/golang/go synced 2024-11-20 06:04:52 -07:00

cmd/doc: submit to the punched card tyranny

People use 80-column terminals because their grandparents used
punched cards. When I last used a punched card, in 1978, it seemed
antiquated even then. But today, people still set their terminal
widths to 80 to honor the struggles their fallen ancestors made to
endure this painful technology.

We must all stand and salute the 80 column flag, or risk the opprobium
of our peers.

For Pete's sake, I don't even use a fixed-width font. I don't even
believe in columns.

Fixes #11639 with extreme reluctance.

P.S. To avoid the horror of an automatically folded line of text, this commit message has been formatted to fit on an 80-column line, except for this postscript.

Change-Id: Ia2eb2dcf293dabe804c22ee5abb4bbb703f45c33
Reviewed-on: https://go-review.googlesource.com/12011
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Rob Pike 2015-07-10 11:52:39 +10:00
parent 315e5c99d8
commit a625b91916

View File

@ -20,6 +20,12 @@ import (
"unicode/utf8"
)
const (
punchedCardWidth = 80 // These things just won't leave us alone.
indentedWidth = punchedCardWidth - len(indent)
indent = " "
)
type Package struct {
writer io.Writer // Destination for output.
name string // Package name, json for encoding/json.
@ -135,7 +141,7 @@ func (pkg *Package) emit(comment string, node ast.Node) {
}
if comment != "" {
pkg.newlines(2) // Guarantee blank line before comment.
doc.ToText(&pkg.buf, comment, " ", "\t", 80)
doc.ToText(&pkg.buf, comment, " ", indent, indentedWidth)
}
pkg.newlines(1)
}
@ -204,7 +210,7 @@ func (pkg *Package) packageDoc() {
pkg.packageClause(false)
}
doc.ToText(&pkg.buf, pkg.doc.Doc, "", "\t", 80)
doc.ToText(&pkg.buf, pkg.doc.Doc, "", indent, indentedWidth)
pkg.newlines(1)
if !pkg.showInternals() {