Walker for hclwrite package?
- Dominant language
- Go
- Stars
- 5.8k
- Forks
- 657
- Avg merge
- 20h 36m
- Merged PRs (30d)
- 6
Description
It seems like there is a walk function in hclysyntax but not in hclwrite. To walk all the nodes in hclwrite, one need to iterate over the items, which is inefficient. I think part of the problem comes that there are two parsers, one in `hclsyntax` and one in `hclwrite`. According to the doc this was done intentionally so **modifying** is better supported in `hclwrite`. But then there is no walk function in `hclwrite`.
I wonder if there is a preferred way to walk and rewrite nodes? If not I think we should have a special walker for `hclwrite` with support for rewriting nodes. (as a side note, a recent addition to the go/ast package was added that introduced AST rewrite functionality, that traverses the Tree and rewrites during the walk: https://github.com/golang/go/issues/17108 )
Let me know what the thoughts and intention here are, maybe I'm missing something :)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing the existing walk function in hclsyntax with the item-iteration approach in hclwrite, then review the package documentation describing why hclwrite uses a separate parser. Use the Go AST rewrite discussion linked in the issue as context; done would require a decided, documented approach for walking and rewriting hclwrite nodes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100