Skip to content

Commit

Permalink
Review feedback group 7
Browse files Browse the repository at this point in the history
  • Loading branch information
flotter committed Aug 28, 2024
1 parent 9a51cfe commit bd65e52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions internals/plan/extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ var extensionTests = []struct {
a: a
b: b`,
}},
error: "cannot validate layer section .* cannot accept entry not starting .*",
error: ".*cannot accept entry not starting.*",
}, {
summary: "Load file layers with section validation failure #2",
extensions: []extension{{
Expand All @@ -209,7 +209,7 @@ var extensionTests = []struct {
x-field:
x1:`,
}},
error: "cannot validate layer section .* cannot have nil entry .*",
error: ".*cannot have nil entry.*",
}, {
summary: "Load file layers failed plan validation",
extensions: []extension{{
Expand Down Expand Up @@ -244,7 +244,7 @@ var extensionTests = []struct {
a: a
b: b`,
}},
error: "cannot validate plan section .* cannot find .* as required by .*",
error: ".*cannot find.*",
}, {
summary: "Check empty section omits entry",
extensions: []extension{{
Expand Down
8 changes: 4 additions & 4 deletions internals/plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,10 +954,10 @@ func (layer *Layer) Validate() error {
}
}

for field, section := range layer.Sections {
for _, section := range layer.Sections {
err := section.Validate()
if err != nil {
return fmt.Errorf("cannot validate layer section %q: %w", field, err)
return err
}
}

Expand Down Expand Up @@ -1055,10 +1055,10 @@ func (p *Plan) Validate() error {
}

// Each section extension must validate the combined plan.
for field, extension := range sectionExtensions {
for _, extension := range sectionExtensions {
err = extension.ValidatePlan(p)
if err != nil {
return fmt.Errorf("cannot validate plan section %q: %w", field, err)
return err
}
}

Expand Down

0 comments on commit bd65e52

Please sign in to comment.