]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add -race flag to 'go list'
authorRob Pike <r@golang.org>
Thu, 29 Aug 2013 01:16:53 +0000 (11:16 +1000)
committerRob Pike <r@golang.org>
Thu, 29 Aug 2013 01:16:53 +0000 (11:16 +1000)
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

src/cmd/go/list.go

index 6b729aaec416bf1e49d535ad2273549d2dc72269..f56ebed38293a042594166940f15e8e57d3517aa 100644 (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) {