github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/src/cmd/go/fix.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 var cmdFix = &Command{ 8 Run: runFix, 9 UsageLine: "fix [packages]", 10 Short: "run go tool fix on packages", 11 Long: ` 12 Fix runs the Go fix command on the packages named by the import paths. 13 14 For more about fix, see 'godoc fix'. 15 For more about specifying packages, see 'go help packages'. 16 17 To run fix with specific options, run 'go tool fix'. 18 19 See also: go fmt, go vet. 20 `, 21 } 22 23 func runFix(cmd *Command, args []string) { 24 for _, pkg := range packages(args) { 25 // Use pkg.gofiles instead of pkg.Dir so that 26 // the command only applies to this package, 27 // not to packages in subdirectories. 28 run(stringList(tool("fix"), relPaths(pkg.allgofiles))) 29 } 30 }