aboutsummaryrefslogtreecommitdiff
path: root/godoc
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2019-04-22 22:27:50 -0400
committerDmitri Shuralyov <dmitshur@golang.org>2019-05-17 16:27:34 +0000
commit1da8801a9502f29f3f03edfc3149b947e6e1913c (patch)
tree892f763175ab6062b6c6fa67414c0716c1787485 /godoc
parentbffc5affc6df36a7c1fee87811e47b69912e721f (diff)
downloadgolang-x-tools-1da8801a9502f29f3f03edfc3149b947e6e1913c.tar.gz
godoc: declare small victory over the punched card tyranny
At least inside this one package. It's because golang.org/x/tools/cmd/godoc no longer has CLI support as of golang/go#25443, it is now only a web server. Luckily, browsers that display HTML pages are not constrained to the fixed width of punched cards. On the contrary, they seem to embrace a wide variety of arbitrary page widths, ranging from narrow to wide. This is in part due to the proliferation of internet access on device form factors such as the mobile phone, tablet, laptop, and desktop. So the punchCardWidth constant is now unused and can be removed. This is a followup to CL 141397 that removed most of the CLI support code, including the function comment_textFunc, which was its only user. Same goes for containsOnlySpace. Updates golang/go#25443 Change-Id: I61fabe6ea801c88758fb2c6aefa70b53d52e2cb5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/172975 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'godoc')
-rw-r--r--godoc/godoc.go20
1 files changed, 0 insertions, 20 deletions
diff --git a/godoc/godoc.go b/godoc/godoc.go
index 0681a5adb..c84816a25 100644
--- a/godoc/godoc.go
+++ b/godoc/godoc.go
@@ -355,26 +355,6 @@ func comment_htmlFunc(comment string) string {
return buf.String()
}
-// punchCardWidth is the number of columns of fixed-width
-// characters to assume when wrapping text. Very few people
-// use terminals or cards smaller than 80 characters, so 80 it is.
-// We do not try to sniff the environment or the tty to adapt to
-// the situation; instead, by using a constant we make sure that
-// godoc always produces the same output regardless of context,
-// a consistency that is lost otherwise. For example, if we sniffed
-// the environment or tty, then http://golang.org/pkg/math/?m=text
-// would depend on the width of the terminal where godoc started,
-// which is clearly bogus. More generally, the Unix tools that behave
-// differently when writing to a tty than when writing to a file have
-// a history of causing confusion (compare `ls` and `ls | cat`), and we
-// want to avoid that mistake here.
-const punchCardWidth = 80
-
-func containsOnlySpace(buf []byte) bool {
- isNotSpace := func(r rune) bool { return !unicode.IsSpace(r) }
- return bytes.IndexFunc(buf, isNotSpace) == -1
-}
-
// sanitizeFunc sanitizes the argument src by replacing newlines with
// blanks, removing extra blanks, and by removing trailing whitespace
// and commas before closing parentheses.