The -i flag installs the packages that are dependencies of the target.
-The build flags are shared by the build, install, run, and test commands:
+The build flags are shared by the build, clean, get, install, list, run,
+and test commands:
-a
force rebuilding of packages that are already up-to-date.
}
}
-// addBuildFlags adds the flags common to the build and install commands.
+// addBuildFlags adds the flags common to the build, clean, get,
+// install, list, run, and test commands.
func addBuildFlags(cmd *Command) {
// NOTE: If you add flags here, also add them to testflag.go.
cmd.Flag.BoolVar(&buildA, "a", false, "")
)
var cmdClean = &Command{
- UsageLine: "clean [-i] [-r] [-n] [-x] [packages]",
+ UsageLine: "clean [-i] [-r] [-n] [-x] [build flags] [packages]",
Short: "remove object files",
Long: `
Clean removes object files from package source directories.
The -x flag causes clean to print remove commands as it executes them.
+For more about build flags, see 'go help build'.
+
For more about specifying packages, see 'go help packages'.
`,
}
var cleanI bool // clean -i flag
-var cleanN bool // clean -n flag
var cleanR bool // clean -r flag
-var cleanX bool // clean -x flag
func init() {
// break init cycle
cmdClean.Run = runClean
cmdClean.Flag.BoolVar(&cleanI, "i", false, "")
- cmdClean.Flag.BoolVar(&cleanN, "n", false, "")
cmdClean.Flag.BoolVar(&cleanR, "r", false, "")
- cmdClean.Flag.BoolVar(&cleanX, "x", false, "")
+ // -n and -x are important enough to be
+ // mentioned explicitly in the docs but they
+ // are part of the build flags.
+
+ addBuildFlags(cmdClean)
}
func runClean(cmd *Command, args []string) {
}
}
- if cleanN || cleanX {
+ if buildN || buildX {
b.showcmd(p.Dir, "rm -f %s", strings.Join(allRemove, " "))
}
if dir.IsDir() {
// TODO: Remove once Makefiles are forgotten.
if cleanDir[name] {
- if cleanN || cleanX {
+ if buildN || buildX {
b.showcmd(p.Dir, "rm -r %s", name)
- if cleanN {
+ if buildN {
continue
}
}
continue
}
- if cleanN {
+ if buildN {
continue
}
}
if cleanI && p.target != "" {
- if cleanN || cleanX {
+ if buildN || buildX {
b.showcmd("", "rm -f %s", p.target)
}
- if !cleanN {
+ if !buildN {
removeFile(p.target)
}
}
dir := p.swigDir(&buildContext)
soname := p.swigSoname(f)
target := filepath.Join(dir, soname)
- if cleanN || cleanX {
+ if buildN || buildX {
b.showcmd("", "rm -f %s", target)
}
- if !cleanN {
+ if !buildN {
removeFile(target)
}
}
Usage:
- go build [-o output] [build flags] [packages]
+ go build [-o output] [-i] [build flags] [packages]
Build compiles the packages named by the import paths,
along with their dependencies, but it does not install the results.
f1.go f2.go'; with no files provided ('go build'), the output file
name is the base name of the containing directory.
+The -i flag installs the packages that are dependencies of the target.
+
The build flags are shared by the build, install, run, and test commands:
-a
Usage:
- go clean [-i] [-r] [-n] [-x] [packages]
+ go clean [-i] [-r] [-n] [-x] [build flags] [packages]
Clean removes object files from package source directories.
The go command builds most objects in a temporary directory,
The -x flag causes clean to print remove commands as it executes them.
+For more about build flags, see 'go help build'.
+
For more about specifying packages, see 'go help packages'.
Usage:
- go list [-e] [-race] [-f format] [-json] [-tags 'tag list'] [packages]
+ go list [-e] [-f format] [-json] [build flags] [packages]
List lists the packages named by the import paths, one per line.
a non-nil Error field; other information may or may not be missing
(zeroed).
-The -tags flag specifies a list of build tags, like in the 'go build'
-command.
-
-The -race flag causes the package data to include the dependencies
-required by the race detector.
+For more about build flags, see 'go help build'.
For more about specifying packages, see 'go help packages'.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// TODO: Dashboard upload
-
package main
import (
and their dependencies. By default, get uses the network to check out
missing packages but does not use it to look for updates to existing packages.
-Get also accepts all the flags in the 'go build' and 'go install' commands,
-to control the installation. See 'go help build'.
+Get also accepts build flags to control the installation. See 'go help build'.
When checking out or updating a package, get looks for a branch or tag
that matches the locally installed version of Go. The most important
)
var cmdList = &Command{
- UsageLine: "list [-e] [-race] [-f format] [-json] [-tags 'tag list'] [packages]",
+ UsageLine: "list [-e] [-f format] [-json] [build flags] [packages]",
Short: "list packages",
Long: `
List lists the packages named by the import paths, one per line.
a non-nil Error field; other information may or may not be missing
(zeroed).
-The -tags flag specifies a list of build tags, like in the 'go build'
-command.
-
-The -race flag causes the package data to include the dependencies
-required by the race detector.
+For more about build flags, see 'go help build'.
For more about specifying packages, see 'go help packages'.
`,
func init() {
cmdList.Run = runList // break init cycle
- cmdList.Flag.Var(buildCompiler{}, "compiler", "")
- cmdList.Flag.Var((*stringsFlag)(&buildContext.BuildTags), "tags", "")
+ addBuildFlags(cmdList)
}
var listE = cmdList.Flag.Bool("e", false, "")
var listFmt = cmdList.Flag.String("f", "{{.ImportPath}}", "")
var listJson = cmdList.Flag.Bool("json", false, "")
-var listRace = cmdList.Flag.Bool("race", false, "")
var nl = []byte{'\n'}
func runList(cmd *Command, args []string) {
out := newTrackingWriter(os.Stdout)
defer out.w.Flush()
- if *listRace {
- buildRace = true
- }
-
var do func(*Package)
if *listJson {
do = func(p *Package) {