mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
go/parser: deprecate parser.ParseDir
Fixes #71122 Change-Id: Icaf27842f4a42e11eea4bd2203eba5d56610c196 Reviewed-on: https://go-review.googlesource.com/c/go/+/649275 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Commit-Queue: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
3f46587fe0
commit
abd0239113
1
api/next/71122.txt
Normal file
1
api/next/71122.txt
Normal file
@ -0,0 +1 @@
|
||||
pkg go/parser, func ParseDir //deprecated #71122
|
1
doc/next/6-stdlib/99-minor/go/parser/71122.md
Normal file
1
doc/next/6-stdlib/99-minor/go/parser/71122.md
Normal file
@ -0,0 +1 @@
|
||||
The [ParseDir] function is deprecated.
|
@ -145,6 +145,11 @@ func ParseFile(fset *token.FileSet, filename string, src any, mode Mode) (f *ast
|
||||
// If the directory couldn't be read, a nil map and the respective error are
|
||||
// returned. If a parse error occurred, a non-nil but incomplete map and the
|
||||
// first error encountered are returned.
|
||||
//
|
||||
// Deprecated: ParseDir does not consider build tags when associating
|
||||
// files with packages. For precise information about the relationship
|
||||
// between packages and files, use golang.org/x/tools/go/packages,
|
||||
// which can also optionally parse and type-check the files too.
|
||||
func ParseDir(fset *token.FileSet, path string, filter func(fs.FileInfo) bool, mode Mode) (pkgs map[string]*ast.Package, first error) {
|
||||
list, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user