From cfb0bd94df7ececddb00f458fbf22733d22e2d16 Mon Sep 17 00:00:00 2001 From: Guinevere Saenger Date: Wed, 18 Sep 2024 09:25:24 -0700 Subject: [PATCH] fix: edit rule paths (#2422) Installation docs were calling edit rules without filtering for valid paths first. This PR fixes that. --- pkg/tfgen/installation_docs.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/tfgen/installation_docs.go b/pkg/tfgen/installation_docs.go index c6f82cff1..0178d5f5c 100644 --- a/pkg/tfgen/installation_docs.go +++ b/pkg/tfgen/installation_docs.go @@ -131,12 +131,9 @@ func applyEditRules(contentBytes []byte, docFile string, g *Generator) ([]byte, reReplace(`block contains the following arguments`, `input has the following nested fields`), ) - var err error - for _, rule := range edits { - contentBytes, err = rule.Edit(docFile, contentBytes) - if err != nil { - return nil, err - } + contentBytes, err := edits.apply(docFile, contentBytes) + if err != nil { + return nil, err } return contentBytes, nil }