mercari / hcledit

Go package to edit HCL configuration
MIT License
44 stars 13 forks source link

Keytrail shadowed in Walker #97

Open GeorgeDuckman opened 10 months ago

GeorgeDuckman commented 10 months ago

Hi,

I might have found an issue, sorry if I'm wrong, but the variable keytrail in the function walkBlock is shadowed by the function argument.

func (w *Walker) walkBlock(body *hclwrite.Body, queries []query.Query, index int, keytrail []string) error {
    for _, block := range body.Blocks() {
        blockIndex := index
        if !queries[blockIndex].Match(block.Type()) {
            continue
        }

        blockIndex++
        keytrail := append(keytrail, block.Type()) // Right there, should be '=' not ':='