Skip to content
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

gotohelm: Add MustRegexSplit #373

Merged
merged 1 commit into from
Jan 8, 2025
Merged

Conversation

chrisseto
Copy link
Contributor

This commit adds the sprig mustRegexSplit function to the helmette package.

@chrisseto chrisseto enabled auto-merge (rebase) January 8, 2025 16:55
Comment on lines +253 to +254
r := regexp.MustCompile(pattern)
return r.Split(s, n)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On one hand split error is returned to the user, but on the other hand regexp can panic the execution. Could you use regexp.Compile and return an error too?

The same as it is in sprig
https://github.com/Masterminds/sprig/blob/8cb06fe3c8b0f1163c26b0a558669da72ee14656/regex.go#L73-L79

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I can never keep the meaning of Must straight. From gotohelm's perspective, they largely function the same.

Either way, I added support for both!

This commit adds the sprig `mustRegexSplit` function to the `helmette` package.
@chrisseto chrisseto merged commit 2b22773 into main Jan 8, 2025
8 checks passed
@chrisseto chrisseto deleted the chris/p/gotohelm-mustregexsplit branch January 8, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants