Skip to content

v0.12.0-alpha3

@kelseyhightower kelseyhightower tagged this 24 Feb 08:42
The `getv` template function does not accept a default value. The
workaround is to write templates like this:

    {{if exists "/example/app/option"}}
    option = {{getv "/example/app/option"}}{{else}}default_value{{end}}

Resolve the issue by accepting an optional default value. Templates
can now be written like this:

    value: {{getv "/key" "default_value"}}

This change is backwards compatible with the current `getv` function.
If the key is missing and a default value is given the missing key error
will be suppressed and the default value will be returned.

If the key is missing and no default value is given the `getv` function
will return an error and template processing will halt.

Fixes #219
Assets 2
Loading