Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

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

Merged
jrasell merged 2 commits intomasterfrom
missing-key-zero
Mar 17, 2019
Merged

Use missingkey=zero rather than error in template rendering.#275
jrasell merged 2 commits intomasterfrom
missing-key-zero

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants