Skip to content

Commit 65aea30

Browse files
rrjjvvCopilot
andcommitted
Apply suggestions from code review
Co-authored-by: Copilot <[email protected]> Signed-off-by: Roberto Villarreal <[email protected]>
1 parent 956fc0c commit 65aea30

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bake/hclparser/hclparser.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ func (p *parser) resolveValue(ectx *hcl.EvalContext, name string) (err error) {
373373
func (p *parser) valueHasOverride(name string, favorJSON bool) (string, bool, bool) {
374374
jsonEnv := false
375375
envv, hasEnv := p.opt.LookupVar(name)
376+
// If no plain override exists (!hasEnv) or JSON overrides are explicitly favored (favorJSON),
377+
// check for a JSON-specific override with the "_JSON" suffix.
376378
if !hasEnv || favorJSON {
377379
jsonVarName := name + jsonEnvOverrideSuffix
378380
_, builtin := p.opt.Vars[jsonVarName]
@@ -1086,7 +1088,7 @@ func valueFromCSV(name, value string, target cty.Type) (cty.Value, error) {
10861088
for _, f := range fields {
10871089
kvSlice, err = p.Fields(f, kvSlice)
10881090
if err != nil {
1089-
return cty.NilVal, errors.Wrapf(err, "failed to parse %s as k/v", f)
1091+
return cty.NilVal, errors.Wrapf(err, "failed to parse %s as k/v for variable %s", f, name)
10901092
}
10911093
if len(kvSlice) != 2 {
10921094
return cty.NilVal, errors.Errorf("expected one k/v pair but got %d pieces from %s", len(kvSlice), f)

0 commit comments

Comments
 (0)