Skip to content

Use of deprecated ast.Object #121

Description

@cbandy

cmd/errtrace uses ast.Object which was deprecated in Go 1.22. Discussed here: https://go.dev/issue/52463

Activity

  1. abhinav commented on Jan 26, 2025

    @abhinav
    Contributor

    Yeah, we'll need to switch to go/types for the auto-instrumenter.

  2. prashantv commented on Jun 9, 2025

    @prashantv
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions