-
Notifications
You must be signed in to change notification settings - Fork 509
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
bake: add indexof
hcl func
#2384
Conversation
f8777f2
to
a88a281
Compare
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.
As we have already shipped a different functionality under name "index" (and index function to return element at specific index from array isn't very unusual) I don't think we can just change the definition. The new functionality looks ok but we should use a different name, maybe "indexof", or "search"?
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 still need tests for this functionality as mentioned in previous comment. Let us know if you need any extra guidance with that.
bake/hclparser/stdlib.go
Outdated
// IndexFunc constructs a function that finds the element index for a given value in a list. | ||
// | ||
// This function was imported from terraform's collection functions. | ||
var IndexFunc = function.New(&function.Spec{ |
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.
rename to IndexOfFunc
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.
- Renaming
IndexOfFunc
done - Guidance is more than welcome = as explained, I didn't do much and "copy/pasted" (from
terraform
) a similar solution @jedevc had done 2 years ago withtimestampFunc
= Can you point me where the corresponding tests are ... or any related to the set of functions mapped/created in thisbake/hclparser/stdlib.go
? Thanks
a22bfbc
to
ad4c205
Compare
Signed-off-by: Usual Coder <[email protected]>
ad4c205
to
bcc0cd5
Compare
Signed-off-by: CrazyMax <[email protected]>
8350414
to
0a7f5c4
Compare
Added extra commits to test this new func. |
@crazy-max (and @tonistiigi) thanks 🙇 |
Fix #2383