Commit a7e81c37 authored by Jeff R. Allen's avatar Jeff R. Allen Committed by Rob Pike

cmd/go: avoid long lines in help messages

Reformat some help messages to stay within 80 characters.

Fixes #11840.

Change-Id: Iebafcb616f202ac44405e5897097492a79a51722
Reviewed-on: https://go-review.googlesource.com/12514Reviewed-by: default avatarRob Pike <r@golang.org>
parent 6aa48a9a
...@@ -204,8 +204,8 @@ Usage: ...@@ -204,8 +204,8 @@ Usage:
Doc prints the documentation comments associated with the item identified by its 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 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 summary of each of the first-level items "under" that item (package-level
for a package, methods for a type, etc.). declarations for a package, methods for a type, etc.).
Doc accepts zero, one, or two arguments. Doc accepts zero, one, or two arguments.
...@@ -213,30 +213,31 @@ Given no arguments, that is, when run as ...@@ -213,30 +213,31 @@ Given no arguments, that is, when run as
go doc go doc
it prints the package documentation for the package in the current directory. If it prints the package documentation for the package in the current directory.
the package is a command (package main), the exported symbols of the package are If the package is a command (package main), the exported symbols of the package
elided from the presentation unless the -cmd flag is provided. 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 When run with one argument, the argument is treated as a Go-syntax-like
of the item to be documented. What the argument selects depends on what is installed representation of the item to be documented. What the argument selects depends
in GOROOT and GOPATH, as well as the form of the argument, which is schematically on what is installed in GOROOT and GOPATH, as well as the form of the argument,
one of these: which is schematically one of these:
go doc <pkg> go doc <pkg>
go doc <sym>[.<method>] go doc <sym>[.<method>]
go doc [<pkg>].<sym>[.<method>] go doc [<pkg>].<sym>[.<method>]
The first item in this list matched by the argument is the one whose documentation The first item in this list matched by the argument is the one whose
is printed. (See the examples below.) For packages, the order of scanning is documentation is printed. (See the examples below.) For packages, the order of
determined lexically, but the GOROOT tree is always scanned before GOPATH. 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 If there is no package specified or matched, the package in the current
is selected, so "go doc Foo" shows the documentation for symbol Foo in the current directory is selected, so "go doc Foo" shows the documentation for symbol Foo in
package. the current package.
The package path must be either a qualified path or a proper suffix of a path. The The package path must be either a qualified path or a proper suffix of a
go tool's usual package mechanism does not apply: package path elements like . and path. The go tool's usual package mechanism does not apply: package path
... are not implemented by go doc. 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 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 suffix), and the second is a symbol or symbol and method; this is similar to the
...@@ -254,7 +255,8 @@ Examples: ...@@ -254,7 +255,8 @@ Examples:
Show documentation for current package. Show documentation for current package.
go doc Foo go doc Foo
Show documentation for Foo in the current package. 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 go doc encoding/json
Show documentation for the encoding/json package. Show documentation for the encoding/json package.
go doc json go doc json
...@@ -621,7 +623,8 @@ Run compiles and runs the main package comprising the named Go source files. ...@@ -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. 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...'. 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 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 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, on the current search path, 'go run' invokes the binary using that program,
......
...@@ -10,11 +10,10 @@ var cmdDoc = &Command{ ...@@ -10,11 +10,10 @@ var cmdDoc = &Command{
CustomFlags: true, CustomFlags: true,
Short: "show documentation for package or symbol", Short: "show documentation for package or symbol",
Long: ` Long: `
Doc prints the documentation comments associated with the item identified by its 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 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 summary of each of the first-level items "under" that item (package-level
for a package, methods for a type, etc.). declarations for a package, methods for a type, etc.).
Doc accepts zero, one, or two arguments. Doc accepts zero, one, or two arguments.
...@@ -22,30 +21,31 @@ Given no arguments, that is, when run as ...@@ -22,30 +21,31 @@ Given no arguments, that is, when run as
go doc go doc
it prints the package documentation for the package in the current directory. If it prints the package documentation for the package in the current directory.
the package is a command (package main), the exported symbols of the package are If the package is a command (package main), the exported symbols of the package
elided from the presentation unless the -cmd flag is provided. 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 When run with one argument, the argument is treated as a Go-syntax-like
of the item to be documented. What the argument selects depends on what is installed representation of the item to be documented. What the argument selects depends
in GOROOT and GOPATH, as well as the form of the argument, which is schematically on what is installed in GOROOT and GOPATH, as well as the form of the argument,
one of these: which is schematically one of these:
go doc <pkg> go doc <pkg>
go doc <sym>[.<method>] go doc <sym>[.<method>]
go doc [<pkg>].<sym>[.<method>] go doc [<pkg>].<sym>[.<method>]
The first item in this list matched by the argument is the one whose documentation The first item in this list matched by the argument is the one whose
is printed. (See the examples below.) For packages, the order of scanning is documentation is printed. (See the examples below.) For packages, the order of
determined lexically, but the GOROOT tree is always scanned before GOPATH. 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 If there is no package specified or matched, the package in the current
is selected, so "go doc Foo" shows the documentation for symbol Foo in the current directory is selected, so "go doc Foo" shows the documentation for symbol Foo in
package. the current package.
The package path must be either a qualified path or a proper suffix of a path. The The package path must be either a qualified path or a proper suffix of a
go tool's usual package mechanism does not apply: package path elements like . and path. The go tool's usual package mechanism does not apply: package path
... are not implemented by go doc. 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 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 suffix), and the second is a symbol or symbol and method; this is similar to the
...@@ -63,7 +63,8 @@ Examples: ...@@ -63,7 +63,8 @@ Examples:
Show documentation for current package. Show documentation for current package.
go doc Foo go doc Foo
Show documentation for Foo in the current package. 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 go doc encoding/json
Show documentation for the encoding/json package. Show documentation for the encoding/json package.
go doc json go doc json
......
...@@ -37,7 +37,8 @@ Run compiles and runs the main package comprising the named Go source files. ...@@ -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. 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...'. 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 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 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, on the current search path, 'go run' invokes the binary using that program,
......
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