1
0
mirror of https://github.com/golang/go synced 2024-09-30 16:08:36 -06:00

x/tools/cmd/goimports: define verbose flag in parseFlags

This will allow users to use a different flag name.

Change-Id: I252871b8efb6867e61ca507f59a9663cb7140b7d
Reviewed-on: https://go-review.googlesource.com/26632
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Michael Matloob 2016-08-09 14:04:40 -04:00
parent 72064bd647
commit 29462195f2

View File

@ -31,7 +31,7 @@ var (
write = flag.Bool("w", false, "write result to (source) file instead of stdout")
doDiff = flag.Bool("d", false, "display diffs instead of rewriting files")
srcdir = flag.String("srcdir", "", "choose imports as if source code is from `dir`. When operating on a single file, dir may instead be the complete file name.")
verbose = flag.Bool("v", false, "verbose logging")
verbose bool // verbose logging
cpuProfile = flag.String("cpuprofile", "", "CPU profile output")
memProfile = flag.String("memprofile", "", "memory profile output")
@ -195,6 +195,8 @@ func main() {
// parseFlags parses command line flags and returns the paths to process.
// It's a var so that custom implementations can replace it in other files.
var parseFlags = func() []string {
flag.BoolVar(&verbose, "v", false, "verbose logging")
flag.Parse()
return flag.Args()
}
@ -243,7 +245,7 @@ func gofmtMain() {
}()
}
if *verbose {
if verbose {
log.SetFlags(log.LstdFlags | log.Lmicroseconds)
imports.Debug = true
}