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>
diff --git a/cmd/goimports/goimports.go b/cmd/goimports/goimports.go
index 8ab61b8..fc61ac2 100644
--- a/cmd/goimports/goimports.go
+++ b/cmd/goimports/goimports.go
@@ -31,7 +31,7 @@
 	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 @@
 // 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 @@
 		}()
 	}
 
-	if *verbose {
+	if verbose {
 		log.SetFlags(log.LstdFlags | log.Lmicroseconds)
 		imports.Debug = true
 	}