Skip to content

Commit

Permalink
bake: move merge logic to gohcl package and add tests
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Dec 2, 2024
1 parent d6d713a commit 94b9987
Show file tree
Hide file tree
Showing 3 changed files with 690 additions and 4 deletions.
3 changes: 2 additions & 1 deletion bake/bake.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

composecli "github.com/compose-spec/compose-go/v2/cli"
"github.com/docker/buildx/bake/hclparser"
"github.com/docker/buildx/bake/hclparser/gohcl"
"github.com/docker/buildx/build"
controllerapi "github.com/docker/buildx/controller/pb"
"github.com/docker/buildx/util/buildflags"
Expand Down Expand Up @@ -343,7 +344,7 @@ func ParseFiles(files []File, defaults map[string]string) (_ *Config, _ *hclpars

var pm hclparser.ParseMeta
if len(hclFiles) > 0 {
res, err := hclparser.Parse(hclparser.MergeFiles(hclFiles), hclparser.Opt{
res, err := hclparser.Parse(gohcl.MergeFiles(hclFiles), hclparser.Opt{
LookupVar: os.LookupEnv,
Vars: defaults,
ValidateLabel: validateTargetName,
Expand Down
4 changes: 1 addition & 3 deletions bake/hclparser/merged.go → bake/hclparser/gohcl/merged.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// Forked from https://github.com/hashicorp/hcl/blob/4679383728fe331fc8a6b46036a27b8f818d9bc0/merged.go

package hclparser
package gohcl

import (
"fmt"
Expand Down
Loading

0 comments on commit 94b9987

Please sign in to comment.