diff options
Diffstat (limited to 'src/go/parser')
-rw-r--r-- | src/go/parser/interface.go | 8 | ||||
-rw-r--r-- | src/go/parser/parser_test.go | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/go/parser/interface.go b/src/go/parser/interface.go index 54f9d7b80a..cc7e455c4d 100644 --- a/src/go/parser/interface.go +++ b/src/go/parser/interface.go @@ -12,8 +12,8 @@ import ( "go/ast" "go/token" "io" + "io/fs" "io/ioutil" - "os" "path/filepath" "strings" ) @@ -35,7 +35,7 @@ func readSource(filename string, src interface{}) ([]byte, error) { return s.Bytes(), nil } case io.Reader: - return ioutil.ReadAll(s) + return io.ReadAll(s) } return nil, errors.New("invalid source") } @@ -123,7 +123,7 @@ func ParseFile(fset *token.FileSet, filename string, src interface{}, mode Mode) // directory specified by path and returns a map of package name -> package // AST with all the packages found. // -// If filter != nil, only the files with os.FileInfo entries passing through +// If filter != nil, only the files with fs.FileInfo entries passing through // the filter (and ending in ".go") are considered. The mode bits are passed // to ParseFile unchanged. Position information is recorded in fset, which // must not be nil. @@ -132,7 +132,7 @@ func ParseFile(fset *token.FileSet, filename string, src interface{}, mode Mode) // returned. If a parse error occurred, a non-nil but incomplete map and the // first error encountered are returned. // -func ParseDir(fset *token.FileSet, path string, filter func(os.FileInfo) bool, mode Mode) (pkgs map[string]*ast.Package, first error) { +func ParseDir(fset *token.FileSet, path string, filter func(fs.FileInfo) bool, mode Mode) (pkgs map[string]*ast.Package, first error) { list, err := ioutil.ReadDir(path) if err != nil { return nil, err diff --git a/src/go/parser/parser_test.go b/src/go/parser/parser_test.go index 25a374eeef..7193a329fe 100644 --- a/src/go/parser/parser_test.go +++ b/src/go/parser/parser_test.go @@ -9,7 +9,7 @@ import ( "fmt" "go/ast" "go/token" - "os" + "io/fs" "strings" "testing" ) @@ -40,7 +40,7 @@ func nameFilter(filename string) bool { return false } -func dirFilter(f os.FileInfo) bool { return nameFilter(f.Name()) } +func dirFilter(f fs.FileInfo) bool { return nameFilter(f.Name()) } func TestParseFile(t *testing.T) { src := "package p\nvar _=s[::]+\ns[::]+\ns[::]+\ns[::]+\ns[::]+\ns[::]+\ns[::]+\ns[::]+\ns[::]+\ns[::]+\ns[::]+\ns[::]" |