Do type checking after rendering variables #40
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In recent releases of boilerplate, I added support for using interpolations in variable values (e.g.,
default: "{{ .Foo }}"
), but that had a bug in it where I was checking types before rendering a variable. So if you set a variable withtype: bool
to an interpolation such as"{{ eq .SomeValue 42}}"
, you would get an error that the value was of the wrong type.It took a bit of refactoring (99% of the code changes are moving things into different packages to avoid circular dependencies), but the code should now check types after rendering, including coercing values to an expected type (e.g., coercing the string “true” to the bool value true) to make these sorts of interpolations work correctly.