]> Cypherpunks repositories - gostls13.git/commit
cmd/doc: always print package clause except for commands
authorRob Pike <r@golang.org>
Fri, 17 May 2019 03:43:51 +0000 (13:43 +1000)
committerRob Pike <r@golang.org>
Tue, 28 May 2019 00:28:05 +0000 (00:28 +0000)
commitf736de04aa52d4889760ecfe4380da01aaf4758f
treeedb59ef877f0cef9a435f71a6ad82eefa48b6aaa
parent1531192272dfdebc61050a8dafa626ff4b36b3a4
cmd/doc: always print package clause except for commands

There was an implicit heuristic before about when to print the
package clause or omit it, but it was undocumented and confusing.
Get rid of it and print it always unless asking for the package
docs for a command, which are more of a usage message than a
programming question. This simplifies the processing.

There are several paths to the output, so to put the fix in one
place we place a wrapper before the output buffer than adds the
clause when Write is first called.

The tests don't verify this behavior, but they didn't before either.
Unsure what the right approach is but this will do for now.

Fixes #31457

Change-Id: Ia6a9e740d556f45265c55f06b5306621c7a40ea9
Reviewed-on: https://go-review.googlesource.com/c/go/+/177797
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/doc/pkg.go