From 062406bc644f1606a2c0fa6f0e25ac04aebfd55e Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Wed, 8 Dec 2010 21:36:56 -0800 Subject: [PATCH] throughout: simplify two-variable ranges with unused second variable R=golang-dev, gri CC=golang-dev https://golang.org/cl/3529041 --- src/cmd/godoc/godoc.go | 2 +- src/pkg/container/vector/numbers_test.go | 2 +- src/pkg/exp/draw/draw.go | 2 +- src/pkg/go/parser/parser_test.go | 2 +- src/pkg/http/transfer.go | 2 +- src/pkg/index/suffixarray/suffixarray.go | 2 +- src/pkg/reflect/type.go | 2 +- src/pkg/unicode/maketables.go | 4 ++-- test/blank.go | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go index 8fce6cd213..ff51c4dd86 100644 --- a/src/cmd/godoc/godoc.go +++ b/src/cmd/godoc/godoc.go @@ -1182,7 +1182,7 @@ func (h *httpHandler) getPageInfo(abspath, relpath, pkgname string, mode PageInf // (excluding the selected package, if any). plist = make([]string, len(pkgs)) i := 0 - for name, _ := range pkgs { + for name := range pkgs { if pkg == nil || name != pkg.Name { plist[i] = name i++ diff --git a/src/pkg/container/vector/numbers_test.go b/src/pkg/container/vector/numbers_test.go index a44242f67b..93335ca60f 100644 --- a/src/pkg/container/vector/numbers_test.go +++ b/src/pkg/container/vector/numbers_test.go @@ -20,7 +20,7 @@ func s(n uint64) string { lens := len(str) a := make([]string, (lens+2)/3) start := lens - for i, _ := range a { + for i := range a { start -= 3 if start < 0 { start = 0 diff --git a/src/pkg/exp/draw/draw.go b/src/pkg/exp/draw/draw.go index 2f3139d69b..c94ae83a42 100644 --- a/src/pkg/exp/draw/draw.go +++ b/src/pkg/exp/draw/draw.go @@ -268,7 +268,7 @@ func drawFillSrc(dst *image.RGBA, r image.Rectangle, src *image.ColorImage) { dbase := dy0 * dst.Stride i0, i1 := dbase+dx0, dbase+dx1 firstRow := dst.Pix[i0:i1] - for i, _ := range firstRow { + for i := range firstRow { firstRow[i] = color } for y := dy0 + 1; y < dy1; y++ { diff --git a/src/pkg/go/parser/parser_test.go b/src/pkg/go/parser/parser_test.go index 9c9a428b87..56bd80ef1f 100644 --- a/src/pkg/go/parser/parser_test.go +++ b/src/pkg/go/parser/parser_test.go @@ -104,7 +104,7 @@ func TestParse4(t *testing.T) { t.Errorf(`package "parser" not found`) return } - for filename, _ := range pkg.Files { + for filename := range pkg.Files { if !nameFilter(filename) { t.Errorf("unexpected package file: %s", filename) } diff --git a/src/pkg/http/transfer.go b/src/pkg/http/transfer.go index 75030e87df..e62885d62f 100644 --- a/src/pkg/http/transfer.go +++ b/src/pkg/http/transfer.go @@ -108,7 +108,7 @@ func (t *transferWriter) WriteHeader(w io.Writer) (err os.Error) { // writing long headers, using HTTP line splitting io.WriteString(w, "Trailer: ") needComma := false - for k, _ := range t.Trailer { + for k := range t.Trailer { k = CanonicalHeaderKey(k) switch k { case "Transfer-Encoding", "Trailer", "Content-Length": diff --git a/src/pkg/index/suffixarray/suffixarray.go b/src/pkg/index/suffixarray/suffixarray.go index 4839dbb146..2d728e2c3a 100644 --- a/src/pkg/index/suffixarray/suffixarray.go +++ b/src/pkg/index/suffixarray/suffixarray.go @@ -40,7 +40,7 @@ type Index struct { // func New(data []byte) *Index { sa := make([]int, len(data)) - for i, _ := range sa { + for i := range sa { sa[i] = i } x := &Index{data, sa} diff --git a/src/pkg/reflect/type.go b/src/pkg/reflect/type.go index d87ccc984c..9a7467b32d 100644 --- a/src/pkg/reflect/type.go +++ b/src/pkg/reflect/type.go @@ -550,7 +550,7 @@ func (t *StructType) fieldByNameFunc(match func(string) bool, mark map[*StructTy var fi int // field index n := 0 // number of matching fields at depth fd L: - for i, _ := range t.fields { + for i := range t.fields { f := t.Field(i) d := inf switch { diff --git a/src/pkg/unicode/maketables.go b/src/pkg/unicode/maketables.go index c8e7eb4420..081e1a1198 100644 --- a/src/pkg/unicode/maketables.go +++ b/src/pkg/unicode/maketables.go @@ -326,7 +326,7 @@ func printCategories() { if *tablelist == "all" { fmt.Println("// Categories is the set of Unicode data tables.") fmt.Println("var Categories = map[string] []Range {") - for k, _ := range category { + for k := range category { fmt.Printf("\t%q: %s,\n", k, k) } fmt.Print("}\n\n") @@ -594,7 +594,7 @@ func printScriptOrProperty(doProps bool) { fmt.Println("// Scripts is the set of Unicode script tables.") fmt.Println("var Scripts = map[string] []Range {") } - for k, _ := range table { + for k := range table { fmt.Printf("\t%q: %s,\n", k, k) } fmt.Print("}\n\n") diff --git a/test/blank.go b/test/blank.go index b9d3a32a81..6e69f8aaae 100644 --- a/test/blank.go +++ b/test/blank.go @@ -77,7 +77,7 @@ func main() { if out != "123" {panic(out)} sum := 0 - for s, _ := range ints { + for s := range ints { sum += s } if sum != 3 {panic(sum)}