1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:04:41 -07:00

cmd/go: add -race flag to 'go list'

Causes the package dependencies to include those for race detection.
Fixes #5653.

R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/13236045
This commit is contained in:
Rob Pike 2013-08-29 11:16:53 +10:00
parent 1d7699e99c
commit d595b67a12

View File

@ -14,7 +14,7 @@ import (
)
var cmdList = &Command{
UsageLine: "list [-e] [-f format] [-json] [-tags 'tag list'] [packages]",
UsageLine: "list [-e] [-race] [-f format] [-json] [-tags 'tag list'] [packages]",
Short: "list packages",
Long: `
List lists the packages named by the import paths, one per line.
@ -91,6 +91,9 @@ a non-nil Error field; other information may or may not be missing
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 specifying packages, see 'go help packages'.
`,
}
@ -104,12 +107,17 @@ func init() {
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) {