x/tools: simplify and format code

Semi-mechanical changes using gofmt -s
and honnef.co/go/tools/cmd/gosimple.

Change-Id: I41bcf4bea5b16c4776b7cf6534b76aa59b3c022d
Reviewed-on: https://go-review.googlesource.com/37447
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/cmd/callgraph/main.go b/cmd/callgraph/main.go
index 3a5a286..bff39c2 100644
--- a/cmd/callgraph/main.go
+++ b/cmd/callgraph/main.go
@@ -175,7 +175,7 @@
 	}
 
 	// Use the initial packages from the command line.
-	args, err := conf.FromArgs(args, tests)
+	_, err := conf.FromArgs(args, tests)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/guru/testdata/src/alias/alias.go b/cmd/guru/testdata/src/alias/alias.go
index 18487c0..42e1d29 100644
--- a/cmd/guru/testdata/src/alias/alias.go
+++ b/cmd/guru/testdata/src/alias/alias.go
@@ -4,17 +4,20 @@
 
 package alias // @describe describe-pkg "alias"
 
-type I interface{ f() } // @implements implements-I "I"
+type I interface { // @implements implements-I "I"
+	f()
+}
 
 type N int
+
 func (N) f() {}
 
 type M = N // @describe describe-def-M "M"
-var m M // @describe describe-ref-M "M"
+var m M    // @describe describe-ref-M "M"
 
 type O N // @describe describe-O "O"
 
-type P = struct{N} // @describe describe-P "N"
+type P = struct{ N } // @describe describe-P "N"
 
 type U = undefined // @describe describe-U "U"
 type _ = undefined // @describe describe-undefined "undefined"
diff --git a/cmd/guru/testdata/src/peers/main.go b/cmd/guru/testdata/src/peers/main.go
index fa533f6..40ee205 100644
--- a/cmd/guru/testdata/src/peers/main.go
+++ b/cmd/guru/testdata/src/peers/main.go
@@ -35,7 +35,7 @@
 	case chA2 <- &a2: // @peers peer-send-chA' "<-"
 	}
 
-	for _ = range chA {
+	for range chA {
 	}
 
 	close(chA) // @peers peer-close-chA "chA"
diff --git a/cmd/present/dir.go b/cmd/present/dir.go
index 9d34dc8..0276351 100644
--- a/cmd/present/dir.go
+++ b/cmd/present/dir.go
@@ -88,11 +88,7 @@
 
 	var err error
 	dirListTemplate, err = template.ParseFiles(filepath.Join(base, "templates/dir.tmpl"))
-	if err != nil {
-		return err
-	}
-
-	return nil
+	return err
 }
 
 // renderDoc reads the present file, gets its template representation,
diff --git a/cmd/toolstash/main.go b/cmd/toolstash/main.go
index 3a42355..d447dd7 100644
--- a/cmd/toolstash/main.go
+++ b/cmd/toolstash/main.go
@@ -294,7 +294,7 @@
 	}
 
 	cmdS := append([]string{cmd[0], extra}, cmd[1:]...)
-	outfile, ok = cmpRun(true, cmdS)
+	outfile, _ = cmpRun(true, cmdS)
 
 	fmt.Fprintf(os.Stderr, "\n%s\n", compareLogs(outfile))
 	os.Exit(2)
diff --git a/go/gcimporter15/bexport.go b/go/gcimporter15/bexport.go
index 9f5db0e..cbf8bc0 100644
--- a/go/gcimporter15/bexport.go
+++ b/go/gcimporter15/bexport.go
@@ -770,7 +770,7 @@
 // tracef is like fmt.Printf but it rewrites the format string
 // to take care of indentation.
 func (p *exporter) tracef(format string, args ...interface{}) {
-	if strings.IndexAny(format, "<>\n") >= 0 {
+	if strings.ContainsAny(format, "<>\n") {
 		var buf bytes.Buffer
 		for i := 0; i < len(format); i++ {
 			// no need to deal with runes
diff --git a/go/ssa/interp/testdata/coverage.go b/go/ssa/interp/testdata/coverage.go
index 0bc0586..37ef95c 100644
--- a/go/ssa/interp/testdata/coverage.go
+++ b/go/ssa/interp/testdata/coverage.go
@@ -435,7 +435,7 @@
 func init() {
 	// Regression test for SSA renaming bug.
 	var ints []int
-	for _ = range "foo" {
+	for range "foo" {
 		var x int
 		x++
 		ints = append(ints, x)
diff --git a/godoc/cmdline.go b/godoc/cmdline.go
index 9502ebb..7c53681 100644
--- a/godoc/cmdline.go
+++ b/godoc/cmdline.go
@@ -182,7 +182,7 @@
 
 // Does s look like a regular expression?
 func isRegexp(s string) bool {
-	return strings.IndexAny(s, ".(|)*+?^$[]") >= 0
+	return strings.ContainsAny(s, ".(|)*+?^$[]")
 }
 
 // Make a regular expression of the form
diff --git a/present/style.go b/present/style.go
index a6d8d39..e2c228e 100644
--- a/present/style.go
+++ b/present/style.go
@@ -38,7 +38,7 @@
 
 // font returns s with font indicators turned into HTML font tags.
 func font(s string) string {
-	if strings.IndexAny(s, "[`_*") == -1 {
+	if !strings.ContainsAny(s, "[`_*") {
 		return s
 	}
 	words := split(s)