package hclparser
import "github.com/docker/buildx/bake/hclparser"
Index ¶
- func EmptyBody() hcl.Body
- func FilterExcludeBody(body hcl.Body, schema *hcl.BodySchema) hcl.Body
- func FilterIncludeBody(body hcl.Body, schema *hcl.BodySchema) hcl.Body
- func ImpliedType(gv any) (cty.Type, error)
- func MergeBodies(bodies []hcl.Body) hcl.Body
- func MergeFiles(files []*hcl.File) hcl.Body
- func Stdlib() map[string]function.Function
- func ToCtyValue(val any, ty cty.Type) (cty.Value, error)
- func UnwrapCtyValue(in cty.Value) cty.Value
- type FromCtyValueConverter
- type Opt
- type ParseMeta
- type ToCtyValueConverter
- type Variable
- type WithEvalContexts
- type WithGetName
Functions ¶
func EmptyBody ¶
func EmptyBody() hcl.Body
EmptyBody returns a body with no content. This body can be used as a placeholder when a body is required but no body content is available.
func FilterExcludeBody ¶
func FilterExcludeBody(body hcl.Body, schema *hcl.BodySchema) hcl.Body
func FilterIncludeBody ¶
func FilterIncludeBody(body hcl.Body, schema *hcl.BodySchema) hcl.Body
func ImpliedType ¶
ImpliedType takes an arbitrary Go value (as an interface{}) and attempts to find a suitable cty.Type instance that could be used for a conversion with ToCtyValue.
This allows -- for simple situations at least -- types to be defined just once in Go and the cty types derived from the Go types, but in the process it makes some assumptions that may be undesirable so applications are encouraged to build their cty types directly if exacting control is required.
Not all Go types can be represented as cty types, so an error may be returned which is usually considered to be a bug in the calling program. In particular, ImpliedType will never use capsule types in its returned type, because it cannot know the capsule types supported by the calling program.
func MergeBodies ¶
func MergeBodies(bodies []hcl.Body) hcl.Body
MergeBodies is like MergeFiles except it deals directly with bodies, rather than with entire files.
func MergeFiles ¶
func MergeFiles(files []*hcl.File) hcl.Body
MergeFiles combines the given files to produce a single body that contains configuration from all of the given files.
The ordering of the given files decides the order in which contained elements will be returned. If any top-level attributes are defined with the same name across multiple files, a diagnostic will be produced from the Content and PartialContent methods describing this error in a user-friendly way.
func Stdlib ¶
func ToCtyValue ¶
func UnwrapCtyValue ¶
UnwrapCtyValue will unwrap capsule type values into their native cty value equivalents if possible.
Types ¶
type FromCtyValueConverter ¶
type FromCtyValueConverter interface { // FromCtyValue will initialize this value using a cty.Value. FromCtyValue(in cty.Value, path cty.Path) error }
type Opt ¶
type Opt struct { LookupVar func(string) (string, bool) Vars map[string]string ValidateLabel func(string) error }
type ParseMeta ¶
func Parse ¶
type ToCtyValueConverter ¶
type ToCtyValueConverter interface { // ToCtyValue will convert this capsule value into a native // cty.Value. This should not return a capsule type. ToCtyValue() cty.Value }
type Variable ¶
type Variable struct { Name string `json:"name"` Description string `json:"description,omitempty"` Value *string `json:"value,omitempty"` }
type WithEvalContexts ¶
type WithEvalContexts interface { GetEvalContexts(base *hcl.EvalContext, block *hcl.Block, loadDeps func(hcl.Expression) hcl.Diagnostics) ([]*hcl.EvalContext, error) }
type WithGetName ¶
type WithGetName interface { GetName(ectx *hcl.EvalContext, block *hcl.Block, loadDeps func(hcl.Expression) hcl.Diagnostics) (string, error) }
Source Files ¶
body.go expr.go hclparser.go merged.go stdlib.go type_implied.go type_implied_ext.go
Directories ¶
Path | Synopsis |
---|---|
bake/hclparser/gohcl | Package gohcl allows decoding HCL configurations into Go data structures. |
- Version
- v0.22.0 (latest)
- Published
- Mar 17, 2025
- Platform
- linux/amd64
- Imports
- 31 packages
- Last checked
- 3 weeks ago –
Tools for package owners.