buildx/util/userfunc
CrazyMax 2a13491919
Dockerfile: update golangci-lint to 1.48.0 (go 1.19 support)
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-08-11 02:10:33 +02:00
..
README.md temp local copy of userfunc 2021-03-26 17:06:38 -07:00
decode.go bake: allow user functions in variables and vice-versa 2021-05-05 22:08:31 -07:00
doc.go Dockerfile: update golangci-lint to 1.48.0 (go 1.19 support) 2022-08-11 02:10:33 +02:00
public.go bake: allow user functions in variables and vice-versa 2021-05-05 22:08:31 -07:00

README.md

HCL User Functions Extension

This HCL extension allows a calling application to support user-defined functions.

Functions are defined via a specific block type, like this:

function "add" {
  params = [a, b]
  result = a + b
}

function "list" {
  params         = []
  variadic_param = items
  result         = items
}

The extension is implemented as a pre-processor for cty.Body objects. Given a body that may contain functions, the DecodeUserFunctions function searches for blocks that define functions and returns a functions map suitable for inclusion in a hcl.EvalContext. It also returns a new cty.Body that contains the remainder of the content from the given body, allowing for further processing of remaining content.

For more information, see the godoc reference.