Commit a625b919 authored by Rob Pike's avatar Rob Pike

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/12011Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 315e5c99
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment