bake: add indexof hcl func#2384
Merged
crazy-max merged 2 commits intodocker:masterfrom Apr 11, 2024
Merged
Conversation
f8777f2 to
a88a281
Compare
tonistiigi
reviewed
Apr 8, 2024
Member
tonistiigi
left a comment
There was a problem hiding this comment.
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"?
3 tasks
tonistiigi
reviewed
Apr 11, 2024
Member
tonistiigi
left a comment
There was a problem hiding this comment.
We still need tests for this functionality as mentioned in previous comment. Let us know if you need any extra guidance with that.
| // 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{ |
Contributor
Author
There was a problem hiding this comment.
- Renaming
IndexOfFuncdone - 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
Member
|
Added extra commits to test this new func. |
tonistiigi
approved these changes
Apr 11, 2024
Contributor
Author
|
@crazy-max (and @tonistiigi) thanks 🙇 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix #2383