Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(go): Add AST #4970

Merged
merged 3 commits into from
Oct 21, 2024
Merged

feat(go): Add AST #4970

merged 3 commits into from
Oct 21, 2024

Conversation

amckinney
Copy link
Member

Re: #4842

This adds the new Go AST library (written in TypeScript), that will be used to generate Go snippets via the dynamic snippet resolver. The package exists alongside the original Go generator in generators/go-v2, just like generators/python-v2.

A few things to note:

  1. This introduces a GoFile node, which extends the Writer.
    • The Writer is responsible for managing all Go import statements and aliases (and is accessible by every AST node), whereas the GoFile is both an AstNode and a Writer.
  2. Several AST nodes are currently unused (e.g. Enum, Field), but partial implementations are included upfront so that it's easy to fill in the gaps when we rewrite the Go generator in TypeScript.
  3. A variety of tests for the new TypeInstantiation AST node are included in the Snippets.test.ts.

@amckinney amckinney requested a review from dsinghvi as a code owner October 21, 2024 19:51
@amckinney amckinney merged commit 8295898 into main Oct 21, 2024
51 checks passed
@amckinney amckinney deleted the amckinney/go/ast branch October 21, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants