diff --git a/cmd/callgraph/main.go b/cmd/callgraph/main.go index 3a5a286770..bff39c2395 100644 --- a/cmd/callgraph/main.go +++ b/cmd/callgraph/main.go @@ -175,7 +175,7 @@ func doCallgraph(ctxt *build.Context, algo, format string, tests bool, args []st } // 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 18487c0c2d..42e1d297f1 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 fa533f64b1..40ee205b27 100644 --- a/cmd/guru/testdata/src/peers/main.go +++ b/cmd/guru/testdata/src/peers/main.go @@ -35,7 +35,7 @@ func main() { 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 9d34dc8369..0276351370 100644 --- a/cmd/present/dir.go +++ b/cmd/present/dir.go @@ -88,11 +88,7 @@ func initTemplates(base string) error { 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 3a42355978..d447dd704b 100644 --- a/cmd/toolstash/main.go +++ b/cmd/toolstash/main.go @@ -294,7 +294,7 @@ func compareTool() { } 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 9f5db0e809..cbf8bc00d6 100644 --- a/go/gcimporter15/bexport.go +++ b/go/gcimporter15/bexport.go @@ -770,7 +770,7 @@ func (p *exporter) rawByte(b byte) { // 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 0bc0586c1d..37ef95c6c7 100644 --- a/go/ssa/interp/testdata/coverage.go +++ b/go/ssa/interp/testdata/coverage.go @@ -435,7 +435,7 @@ func init() { 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 9502ebbe40..7c53681347 100644 --- a/godoc/cmdline.go +++ b/godoc/cmdline.go @@ -182,7 +182,7 @@ func filterInfo(args []string, info *PageInfo) { // 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 a6d8d39cc9..e2c228e55a 100644 --- a/present/style.go +++ b/present/style.go @@ -38,7 +38,7 @@ func Style(s string) template.HTML { // 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)