tflint: Add workaround when parsing a config that has a trailing heredoc #128
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.
Fixes #127
See also #93
If a
plugin
block ends with a heredoc (e.g.signing_key
), the heredoc will not contain a trailing newline when the plugin side process parses the configuration. This does not meet the grammar of the heredoc and results in an "Unterminated template string" error.As with #93,
Unmarshal
always adds a trailing newline when parsing the body. However, this is a pretty bad workaround. The biggest difference from #93 is that the added newline is meaningful. When parsing an expression, newlines are always ignored and do not affect the final parsed result, but when parsing a body the number of newlines does affect the result. For example:The above will be parsed as the following:
This can have a strange effect on the display of the number of lines. However, the number of lines in a config file is only displayed when occurs a parse error mainly, so I will ignore this problem and fix the bug here.