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
errtrace uses ast.Object in a pretty limited way: to resolve identifiers to named returns (within the same function). Using go/types seems heavier, and not sure how well it works when resolving single files (e.g., for errtrace -w <file.go>.
The partial object resolution is all we need, and seems like the functionality isn't going away, but is marked deprecated to help guard against misuse. From the issue:
It is true that, potentially, using the partial object resolution in go/ast is fine for some use cases. Perhaps they only deal with very simple Go code that doesn't run into any of the limitations against go/types. I think it should be fine for those (hopefully very rare) cases to consciously ignore the deprecation notice.
Is the errtrace use-case impacted by any of the limitations? If not, I'm wondering whether switching to go/types will be worthwhile.
cmd/errtrace uses ast.Object which was deprecated in Go 1.22. Discussed here: https://go.dev/issue/52463