Skip to content

Commit

Permalink
cmd/go: avoid long lines in help messages
Browse files Browse the repository at this point in the history
Reformat some help messages to stay within 80 characters.

Fixes golang#11840.

Change-Id: Iebafcb616f202ac44405e5897097492a79a51722
Reviewed-on: https://go-review.googlesource.com/12514
Reviewed-by: Rob Pike <[email protected]>
  • Loading branch information
jeffallen authored and robpike committed Jul 28, 2015
1 parent 6aa48a9 commit a7e81c3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 41 deletions.
43 changes: 23 additions & 20 deletions src/cmd/go/alldocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,39 +204,40 @@ Usage:
Doc prints the documentation comments associated with the item identified by its
arguments (a package, const, func, type, var, or method) followed by a one-line
summary of each of the first-level items "under" that item (package-level declarations
for a package, methods for a type, etc.).
summary of each of the first-level items "under" that item (package-level
declarations for a package, methods for a type, etc.).
Doc accepts zero, one, or two arguments.
Given no arguments, that is, when run as
go doc
it prints the package documentation for the package in the current directory. If
the package is a command (package main), the exported symbols of the package are
elided from the presentation unless the -cmd flag is provided.
it prints the package documentation for the package in the current directory.
If the package is a command (package main), the exported symbols of the package
are elided from the presentation unless the -cmd flag is provided.
When run with one argument, the argument is treated as a Go-syntax-like representation
of the item to be documented. What the argument selects depends on what is installed
in GOROOT and GOPATH, as well as the form of the argument, which is schematically
one of these:
When run with one argument, the argument is treated as a Go-syntax-like
representation of the item to be documented. What the argument selects depends
on what is installed in GOROOT and GOPATH, as well as the form of the argument,
which is schematically one of these:
go doc <pkg>
go doc <sym>[.<method>]
go doc [<pkg>].<sym>[.<method>]
The first item in this list matched by the argument is the one whose documentation
is printed. (See the examples below.) For packages, the order of scanning is
determined lexically, but the GOROOT tree is always scanned before GOPATH.
The first item in this list matched by the argument is the one whose
documentation is printed. (See the examples below.) For packages, the order of
scanning is determined lexically, but the GOROOT tree is always scanned before
GOPATH.
If there is no package specified or matched, the package in the current directory
is selected, so "go doc Foo" shows the documentation for symbol Foo in the current
package.
If there is no package specified or matched, the package in the current
directory is selected, so "go doc Foo" shows the documentation for symbol Foo in
the current package.
The package path must be either a qualified path or a proper suffix of a path. The
go tool's usual package mechanism does not apply: package path elements like . and
... are not implemented by go doc.
The package path must be either a qualified path or a proper suffix of a
path. The go tool's usual package mechanism does not apply: package path
elements like . and ... are not implemented by go doc.
When run with two arguments, the first must be a full package path (not just a
suffix), and the second is a symbol or symbol and method; this is similar to the
Expand All @@ -254,7 +255,8 @@ Examples:
Show documentation for current package.
go doc Foo
Show documentation for Foo in the current package.
(Foo starts with a capital letter so it cannot match a package path.)
(Foo starts with a capital letter so it cannot match
a package path.)
go doc encoding/json
Show documentation for the encoding/json package.
go doc json
Expand Down Expand Up @@ -621,7 +623,8 @@ Run compiles and runs the main package comprising the named Go source files.
A Go source file is defined to be a file ending in a literal ".go" suffix.
By default, 'go run' runs the compiled binary directly: 'a.out arguments...'.
If the -exec flag is given, 'go run' invokes the binary using xprog: 'xprog a.out arguments...'.
If the -exec flag is given, 'go run' invokes the binary using xprog:
'xprog a.out arguments...'.
If the -exec flag is not given, GOOS or GOARCH is different from the system
default, and a program named go_$GOOS_$GOARCH_exec can be found
on the current search path, 'go run' invokes the binary using that program,
Expand Down
41 changes: 21 additions & 20 deletions src/cmd/go/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,42 @@ var cmdDoc = &Command{
CustomFlags: true,
Short: "show documentation for package or symbol",
Long: `
Doc prints the documentation comments associated with the item identified by its
arguments (a package, const, func, type, var, or method) followed by a one-line
summary of each of the first-level items "under" that item (package-level declarations
for a package, methods for a type, etc.).
summary of each of the first-level items "under" that item (package-level
declarations for a package, methods for a type, etc.).
Doc accepts zero, one, or two arguments.
Given no arguments, that is, when run as
go doc
it prints the package documentation for the package in the current directory. If
the package is a command (package main), the exported symbols of the package are
elided from the presentation unless the -cmd flag is provided.
it prints the package documentation for the package in the current directory.
If the package is a command (package main), the exported symbols of the package
are elided from the presentation unless the -cmd flag is provided.
When run with one argument, the argument is treated as a Go-syntax-like representation
of the item to be documented. What the argument selects depends on what is installed
in GOROOT and GOPATH, as well as the form of the argument, which is schematically
one of these:
When run with one argument, the argument is treated as a Go-syntax-like
representation of the item to be documented. What the argument selects depends
on what is installed in GOROOT and GOPATH, as well as the form of the argument,
which is schematically one of these:
go doc <pkg>
go doc <sym>[.<method>]
go doc [<pkg>].<sym>[.<method>]
The first item in this list matched by the argument is the one whose documentation
is printed. (See the examples below.) For packages, the order of scanning is
determined lexically, but the GOROOT tree is always scanned before GOPATH.
The first item in this list matched by the argument is the one whose
documentation is printed. (See the examples below.) For packages, the order of
scanning is determined lexically, but the GOROOT tree is always scanned before
GOPATH.
If there is no package specified or matched, the package in the current directory
is selected, so "go doc Foo" shows the documentation for symbol Foo in the current
package.
If there is no package specified or matched, the package in the current
directory is selected, so "go doc Foo" shows the documentation for symbol Foo in
the current package.
The package path must be either a qualified path or a proper suffix of a path. The
go tool's usual package mechanism does not apply: package path elements like . and
... are not implemented by go doc.
The package path must be either a qualified path or a proper suffix of a
path. The go tool's usual package mechanism does not apply: package path
elements like . and ... are not implemented by go doc.
When run with two arguments, the first must be a full package path (not just a
suffix), and the second is a symbol or symbol and method; this is similar to the
Expand All @@ -63,7 +63,8 @@ Examples:
Show documentation for current package.
go doc Foo
Show documentation for Foo in the current package.
(Foo starts with a capital letter so it cannot match a package path.)
(Foo starts with a capital letter so it cannot match
a package path.)
go doc encoding/json
Show documentation for the encoding/json package.
go doc json
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/go/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Run compiles and runs the main package comprising the named Go source files.
A Go source file is defined to be a file ending in a literal ".go" suffix.
By default, 'go run' runs the compiled binary directly: 'a.out arguments...'.
If the -exec flag is given, 'go run' invokes the binary using xprog: 'xprog a.out arguments...'.
If the -exec flag is given, 'go run' invokes the binary using xprog:
'xprog a.out arguments...'.
If the -exec flag is not given, GOOS or GOARCH is different from the system
default, and a program named go_$GOOS_$GOARCH_exec can be found
on the current search path, 'go run' invokes the binary using that program,
Expand Down

0 comments on commit a7e81c3

Please sign in to comment.