-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: incorrect templating not producing error #765
Changes from 5 commits
8f5dcbc
e818db1
454f4c9
d8ef177
93e68d0
1b10032
43eaa8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,10 +47,7 @@ func extractVariablesFromString(s, prefix string) ([]string, bool) { | |
vars := make([]string, len(matches)) | ||
for i, match := range matches { | ||
groups := matchGroups(match, re) | ||
// foo -> foo | ||
// foo.bar -> foo | ||
// foo.bar.baz -> foo | ||
vars[i] = strings.SplitN(groups["var"], ".", 2)[0] | ||
vars[i] = groups["var"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm having a hard time figuring out if the logic has remained the same here or has been changed to make an intentional difference to behaviour. Would you mind just quickly describing what this change is? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I intentionally made this change. I added a new test to the templating package which hopefully provides additional insight as to why this was needed. This new test would fail without this change.
Since the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK got it, thankyou, I understand the original issue and this fix more clearly now! |
||
} | ||
return vars, true | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could have some unit tests for
AttributesFromType
too :DThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad you recommended this! Ended up running into an issue where this function was not working for one of the types (
PipelineResourceTypeStorage
). I included a fairly kludgy solution and a comment to help illustrate the problem.I do not have more time to look at this at the moment, but will find time soon to try to come up with a more elegant solution.