github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/src/cmd/go/vet.go (about) 1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 func init() { 8 addBuildFlagsNX(cmdVet) 9 } 10 11 var cmdVet = &Command{ 12 Run: runVet, 13 UsageLine: "vet [-n] [-x] [packages]", 14 Short: "run go tool vet on packages", 15 Long: ` 16 Vet runs the Go vet command on the packages named by the import paths. 17 18 For more about vet, see 'godoc code.google.com/p/go.tools/cmd/vet'. 19 For more about specifying packages, see 'go help packages'. 20 21 To run the vet tool with specific options, run 'go tool vet'. 22 23 The -n flag prints commands that would be executed. 24 The -x flag prints commands as they are executed. 25 26 See also: go fmt, go fix. 27 `, 28 } 29 30 func runVet(cmd *Command, args []string) { 31 for _, pkg := range packages(args) { 32 // Use pkg.gofiles instead of pkg.Dir so that 33 // the command only applies to this package, 34 // not to packages in subdirectories. 35 run(tool("vet"), relPaths(stringList(pkg.gofiles, pkg.sfiles))) 36 } 37 }