From dec3d00b28657ce9e2fe725c858a46c3dd3fd594 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 23 Mar 2021 12:30:18 -0700 Subject: [PATCH] cmd/compile/internal/types2: review of stdlib_test.go 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 Reviewed-by: Robert Findley --- .../compile/internal/types2/stdlib_test.go | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/cmd/compile/internal/types2/stdlib_test.go b/src/cmd/compile/internal/types2/stdlib_test.go index 34925687e3..6853bd23b0 100644 --- a/src/cmd/compile/internal/types2/stdlib_test.go +++ b/src/cmd/compile/internal/types2/stdlib_test.go @@ -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())) } } }