|
Note
|
This library is a work in progress |
Templ is a library to allow loading structured data (YAML/JSON/TOML) and applying go-like templating to the string fields, enabling relative references to the same document.
os.Setenv("SOME_ENV_VAR", "some_env_var_value")
params := map[string]string{
"param_name": "param_value"
}
expandedTree, err := templ.New().Params(params).File("./service.yaml").Execute()data:
string: Hello World
array:
- Array
- of
- strings
object:
key: val
example_env: ${ env `SOME_ENV_VAR` }
example_param: ${ param `param_name` }
example_self_1: ${ self `data.string` }
example_self_2: ${ self `data.array` }
example_self_3: ${ self `data.object` }data:
string: Hello World
array:
- Array
- of
- strings
object:
key: val
example_env: some_env_var_value
example_param: param_value
example_1: Hello World
example_2:
array:
- Array
- of
- strings
example_3:
object:
key: val# install golanglint-ci into ./bin
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.16.0
# Install gobin globally
env GO111MODULE=off go get -u github.com/myitcv/gobin|
Note
|
if this repo is cloned into you GOPATH you will need to prefix all commands with GO111MODULES=on
|
-
test:
go test ./... -
lint:
./bin/golangci-lint run ./... -
codegen:
go generate ./...code gen with versioned tool dependencies
-
Preserve the key order when Unmarshalling JSON/YAML/TOML
-
Implement as a lexer/parser/ast
-
Implment Unmarshal-ing the tree into your own custom data types
-
Support for "Layering" Nodes/trees trees similar to onion
-
Add ability to provide additional functions that hook-in to the node tree
-
Marshal tree back to JSON/YAML/TOML
-
Example CLI tool that uses templ library
-
JSON Schema validation
-
Plugin-like ability similar to serverless framework plugins
-