mirror of
https://github.com/golang/go
synced 2024-11-22 04:14:42 -07:00
cmd/go: delete 'go doc'
It's next to useless and confusing as well. Let's make godoc better instead. Fixes #4849. R=golang-dev, dsymonds, adg, rogpeppe, rsc CC=golang-dev https://golang.org/cl/12974043
This commit is contained in:
parent
95e0a8c277
commit
71eae5a46a
@ -16,7 +16,6 @@ The commands are:
|
|||||||
|
|
||||||
build compile packages and dependencies
|
build compile packages and dependencies
|
||||||
clean remove object files
|
clean remove object files
|
||||||
doc run godoc on package sources
|
|
||||||
env print Go environment information
|
env print Go environment information
|
||||||
fix run go tool fix on packages
|
fix run go tool fix on packages
|
||||||
fmt run gofmt on package sources
|
fmt run gofmt on package sources
|
||||||
@ -162,26 +161,6 @@ The -x flag causes clean to print remove commands as it executes them.
|
|||||||
For more about specifying packages, see 'go help packages'.
|
For more about specifying packages, see 'go help packages'.
|
||||||
|
|
||||||
|
|
||||||
Run godoc on package sources
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
|
|
||||||
go doc [-n] [-x] [packages]
|
|
||||||
|
|
||||||
Doc runs the godoc command on the packages named by the
|
|
||||||
import paths.
|
|
||||||
|
|
||||||
For more about godoc, see 'godoc godoc'.
|
|
||||||
For more about specifying packages, see 'go help packages'.
|
|
||||||
|
|
||||||
The -n flag prints commands that would be executed.
|
|
||||||
The -x flag prints commands as they are executed.
|
|
||||||
|
|
||||||
To run godoc with specific options, run godoc itself.
|
|
||||||
|
|
||||||
See also: go fix, go fmt, go vet.
|
|
||||||
|
|
||||||
|
|
||||||
Print Go environment information
|
Print Go environment information
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
@ -229,7 +208,7 @@ The -x flag prints commands as they are executed.
|
|||||||
|
|
||||||
To run gofmt with specific options, run gofmt itself.
|
To run gofmt with specific options, run gofmt itself.
|
||||||
|
|
||||||
See also: go doc, go fix, go vet.
|
See also: go fix, go vet.
|
||||||
|
|
||||||
|
|
||||||
Download and install packages and dependencies
|
Download and install packages and dependencies
|
||||||
@ -880,5 +859,3 @@ See the documentation of the testing package for more information.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// NOTE: cmdDoc is in fmt.go.
|
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "os/exec"
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
addBuildFlagsNX(cmdFmt)
|
addBuildFlagsNX(cmdFmt)
|
||||||
addBuildFlagsNX(cmdDoc)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdFmt = &Command{
|
var cmdFmt = &Command{
|
||||||
@ -27,7 +24,7 @@ The -x flag prints commands as they are executed.
|
|||||||
|
|
||||||
To run gofmt with specific options, run gofmt itself.
|
To run gofmt with specific options, run gofmt itself.
|
||||||
|
|
||||||
See also: go doc, go fix, go vet.
|
See also: go fix, go vet.
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,42 +36,3 @@ func runFmt(cmd *Command, args []string) {
|
|||||||
run(stringList("gofmt", "-l", "-w", relPaths(pkg.allgofiles)))
|
run(stringList("gofmt", "-l", "-w", relPaths(pkg.allgofiles)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdDoc = &Command{
|
|
||||||
Run: runDoc,
|
|
||||||
UsageLine: "doc [-n] [-x] [packages]",
|
|
||||||
Short: "run godoc on package sources",
|
|
||||||
Long: `
|
|
||||||
Doc runs the godoc command on the packages named by the
|
|
||||||
import paths.
|
|
||||||
|
|
||||||
For more about godoc, see 'godoc godoc'.
|
|
||||||
For more about specifying packages, see 'go help packages'.
|
|
||||||
|
|
||||||
The -n flag prints commands that would be executed.
|
|
||||||
The -x flag prints commands as they are executed.
|
|
||||||
|
|
||||||
To run godoc with specific options, run godoc itself.
|
|
||||||
|
|
||||||
See also: go fix, go fmt, go vet.
|
|
||||||
`,
|
|
||||||
}
|
|
||||||
|
|
||||||
func runDoc(cmd *Command, args []string) {
|
|
||||||
_, err := exec.LookPath("godoc")
|
|
||||||
if err != nil {
|
|
||||||
errorf("go doc: can't find godoc; to install:\n\tgo get code.google.com/p/go.tools/cmd/godoc")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for _, pkg := range packages(args) {
|
|
||||||
if pkg.ImportPath == "command-line arguments" {
|
|
||||||
errorf("go doc: cannot use package file list")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if pkg.local {
|
|
||||||
run("godoc", pkg.Dir)
|
|
||||||
} else {
|
|
||||||
run("godoc", pkg.ImportPath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -76,7 +76,6 @@ func (c *Command) Runnable() bool {
|
|||||||
var commands = []*Command{
|
var commands = []*Command{
|
||||||
cmdBuild,
|
cmdBuild,
|
||||||
cmdClean,
|
cmdClean,
|
||||||
cmdDoc,
|
|
||||||
cmdEnv,
|
cmdEnv,
|
||||||
cmdFix,
|
cmdFix,
|
||||||
cmdFmt,
|
cmdFmt,
|
||||||
@ -213,8 +212,6 @@ var documentationTemplate = `// Copyright 2011 The Go Authors. All rights reser
|
|||||||
|
|
||||||
{{end}}*/
|
{{end}}*/
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// NOTE: cmdDoc is in fmt.go.
|
|
||||||
`
|
`
|
||||||
|
|
||||||
// tmpl executes the given template text on data, writing the result to w.
|
// tmpl executes the given template text on data, writing the result to w.
|
||||||
|
Loading…
Reference in New Issue
Block a user