You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The IDE marks ast.Package as deprecated conforming to the comment on the type. But parser.ParseDir() nevertheless references ast.Package in its return type.
What did you expect to see?
Either:
Having deprecated types consistently replaced in the stdlib. Thus, let ParseDir() use the recommended replacement type.
Or:
Having ParseDir() marked as deprecated too.
The text was updated successfully, but these errors were encountered:
mateusz834
changed the title
[consistency] type ast.Package is deprecated but nevertheless used by parser.ParseDir()
go/parser: type ast.Package is deprecated but nevertheless used by parser.ParseDir()
Jan 4, 2025
What did you expect to see?
Either: Having deprecated types consistently replaced in the stdlib. Thus, let ParseDir() use the recommended replacement type.
ParseDir cannot be compatibly changed to return the recommended replacement type.
Or: Having ParseDir() marked as deprecated to.
I think parser.ParseDir is almost never the best solution to a problem, and it returns deprecated data structures, so it does make sense to deprecate it. A more robust solution is to use packages.Load, which invokes go list (or the appropriate build metadata query tool) to get the correct answer.
adonovan
changed the title
go/parser: type ast.Package is deprecated but nevertheless used by parser.ParseDir()
go/parser: deprecate parser.ParseDir (which returns deprecated type ast.Package)
Jan 4, 2025
adonovan
changed the title
go/parser: deprecate parser.ParseDir (which returns deprecated type ast.Package)
proposal: go/parser: deprecate parser.ParseDir (which returns deprecated type ast.Package)
Jan 4, 2025
Go version
1.23.4
Output of
go env
in your module/workspace:What did you do?
Write some simple code using the go/ast and go/parser:
What did you see happen?
The IDE marks
ast.Package
as deprecated conforming to the comment on the type. Butparser.ParseDir()
nevertheless referencesast.Package
in its return type.What did you expect to see?
Either:
ParseDir()
use the recommended replacement type.Or:
ParseDir()
marked as deprecated too.The text was updated successfully, but these errors were encountered: