build compile packages and dependencies
clean remove object files
- doc run godoc on package sources
env print Go environment information
fix run go tool fix on packages
fmt run gofmt on package sources
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
Usage:
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
*/
package main
-
-// NOTE: cmdDoc is in fmt.go.
package main
-import "os/exec"
-
func init() {
addBuildFlagsNX(cmdFmt)
- addBuildFlagsNX(cmdDoc)
}
var cmdFmt = &Command{
To run gofmt with specific options, run gofmt itself.
-See also: go doc, go fix, go vet.
+See also: go fix, go vet.
`,
}
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)
- }
- }
-}