-
Notifications
You must be signed in to change notification settings - Fork 588
bake: add indexof hcl func
#2384
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
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
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 <34403413+Usual-Coder@users.noreply.github.com>
ad4c205 to
bcc0cd5
Compare
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
8350414 to
0a7f5c4
Compare
|
Added extra commits to test this new func. |
|
@crazy-max (and @tonistiigi) thanks 🙇 |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Fix #2383