Replace template parsing with yaml.Decoder #42
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.
This solves some of the edge cases around parsing for empty or invalid document by replacing the string splitting with the yaml package's native handling of multi-document files. Along the way it also simplifies upstream functions by returning parsed yaml as a map[string]interface{} instead of a string. Even after #29 I still had issues with documents like:
In the event of an un-parseable document you'll receive an error with the parsing error and the document the parsing failed on. This isn't extremely useful and returning the chunk around the failure seems like it'd be more useful, but that's beyond my skills and this should point folks in the right direction at least.
One other note is I had to fix a test error that currently exists in master (see 7d26eaf) with the image-regex functionality. Along the way I spent a little time digging in and I'm pretty sure that it doesn't work at all since none of the
Get
calls (see Deployments) are passing through the regex except ConfigMap. I have a partial branch that attempts to make image-regex work but didn't want to block this fix with that.