]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/types2: review of stdlib_test.go
authorRobert Griesemer <gri@golang.org>
Tue, 23 Mar 2021 19:30:18 +0000 (12:30 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 25 Mar 2021 04:21:29 +0000 (04:21 +0000)
The changes between (equivalent, and reviewed) go/types/stdlib_test.go
and stdlib_test.go can be seen by comparing patchset 1 and 2. The actual
changes are removing the "// UNREVIEWED" marker, using the os package
instead of ioutil, and some comment adjustments. Also, bug251.go passes
because of recent changes.

The primary difference is in the firstComment function which
doesn't have access to a scanner and instead uses the syntax
package's CommentsDu function.

Change-Id: I946ffadc97e87c692f76f369a1b16cceee528477
Reviewed-on: https://go-review.googlesource.com/c/go/+/304130
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/stdlib_test.go

index 34925687e3589ab27d74d75c8925268d2a569537..6853bd23b0093bd7881e3525eb7a053f301d6992 100644 (file)
@@ -1,4 +1,3 @@
-// UNREVIEWED
 // Copyright 2013 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
@@ -14,7 +13,6 @@ import (
        "fmt"
        "go/build"
        "internal/testenv"
-       "io/ioutil"
        "os"
        "path/filepath"
        "runtime"
@@ -91,7 +89,7 @@ func firstComment(filename string) (first string) {
 }
 
 func testTestDir(t *testing.T, path string, ignore ...string) {
-       files, err := ioutil.ReadDir(path)
+       files, err := os.ReadDir(path)
        if err != nil {
                t.Fatal(err)
        }
@@ -184,17 +182,16 @@ func TestStdFixed(t *testing.T) {
                "bug248.go", "bug302.go", "bug369.go", // complex test instructions - ignore
                "issue6889.go",   // gc-specific test
                "issue11362.go",  // canonical import path check
-               "issue16369.go",  // go/types handles this correctly - not an issue
-               "issue18459.go",  // go/types doesn't check validity of //go:xxx directives
-               "issue18882.go",  // go/types doesn't check validity of //go:xxx directives
-               "issue20529.go",  // go/types does not have constraints on stack size
-               "issue22200.go",  // go/types does not have constraints on stack size
-               "issue22200b.go", // go/types does not have constraints on stack size
-               "issue25507.go",  // go/types does not have constraints on stack size
-               "issue20780.go",  // go/types does not have constraints on stack size
-               "issue42058a.go", // go/types does not have constraints on channel element size
-               "issue42058b.go", // go/types does not have constraints on channel element size
-               "bug251.go",      // issue #34333 which was exposed with fix for #34151
+               "issue16369.go",  // types2 handles this correctly - not an issue
+               "issue18459.go",  // types2 doesn't check validity of //go:xxx directives
+               "issue18882.go",  // types2 doesn't check validity of //go:xxx directives
+               "issue20529.go",  // types2 does not have constraints on stack size
+               "issue22200.go",  // types2 does not have constraints on stack size
+               "issue22200b.go", // types2 does not have constraints on stack size
+               "issue25507.go",  // types2 does not have constraints on stack size
+               "issue20780.go",  // types2 does not have constraints on stack size
+               "issue42058a.go", // types2 does not have constraints on channel element size
+               "issue42058b.go", // types2 does not have constraints on channel element size
        )
 }
 
@@ -298,7 +295,7 @@ func (w *walker) walk(dir string) {
                return
        }
 
-       fis, err := ioutil.ReadDir(dir)
+       files, err := os.ReadDir(dir)
        if err != nil {
                w.errh(err)
                return
@@ -318,9 +315,9 @@ func (w *walker) walk(dir string) {
        }
 
        // traverse subdirectories, but don't walk into testdata
-       for _, fi := range fis {
-               if fi.IsDir() && fi.Name() != "testdata" {
-                       w.walk(filepath.Join(dir, fi.Name()))
+       for _, f := range files {
+               if f.IsDir() && f.Name() != "testdata" {
+                       w.walk(filepath.Join(dir, f.Name()))
                }
        }
 }