From a7e81c37f4f52da7188082b1384e42d14ec8f586 Mon Sep 17 00:00:00 2001 From: "Jeff R. Allen" Date: Thu, 23 Jul 2015 14:56:13 +0200 Subject: [PATCH] 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/12514 Reviewed-by: Rob Pike --- src/cmd/go/alldocs.go | 43 +++++++++++++++++++++++-------------------- src/cmd/go/doc.go | 41 +++++++++++++++++++++-------------------- src/cmd/go/run.go | 3 ++- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index b5d260a7e8..20ae55d490 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -204,8 +204,8 @@ 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. @@ -213,30 +213,31 @@ 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 go doc [.] go doc [].[.] -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 @@ -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 @@ -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, diff --git a/src/cmd/go/doc.go b/src/cmd/go/doc.go index 03c950552e..4a07dfe11f 100644 --- a/src/cmd/go/doc.go +++ b/src/cmd/go/doc.go @@ -10,11 +10,10 @@ 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. @@ -22,30 +21,31 @@ 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 go doc [.] go doc [].[.] -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 @@ -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 diff --git a/src/cmd/go/run.go b/src/cmd/go/run.go index 6a04a9e19d..f6da373e25 100644 --- a/src/cmd/go/run.go +++ b/src/cmd/go/run.go @@ -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,