Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use missingkey=zero rather than error in template rendering. #275

Merged
merged 2 commits into from
Mar 17, 2019

Conversation

jrasell
Copy link
Member

@jrasell jrasell commented Mar 15, 2019

When performing complex template rendering, it is helpful to be
able to perform if statements based on the existence of a passed
variable like if .env. The template runs fine if the variable
is passed, but if it isn't the execution will stop because of the
missingkey setting. This change proposes setting the missingkey
value to zero rather than error. This means that rather than error
out, the operation returns the zero value for the map type's
element and the render execution can continue.

When performing complex template rendering, it is helpful to be
able to perform if statements based on the existence of a passed
variable like `if .env`. The template runs fine if the variable
is passed, but if it isn't the execution will stop because of the
missingkey setting. This change proposes setting the missingkey
value to zero rather than error. This means that rather than error
out, the operation returns the zero value for the map type's
element and the render execution can continue.
@jrasell jrasell self-assigned this Mar 15, 2019
@jrasell jrasell merged commit f0496fb into master Mar 17, 2019
@jrasell jrasell deleted the missing-key-zero branch March 17, 2019 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants