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

Refactors for safer handling of strings #1578

Merged
merged 2 commits into from
Dec 4, 2023
Merged

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Dec 1, 2023

strings.Cut() was introduced in Go 1.18 for the common use case of splitting a string
in two parts. In these cases it allows to directly assign each one of the parts to variables
with more meaningful names, avoiding the risk of accessing indexes that may not exist,
and improving readability.

Leverage this function in some applicable uses cases we have here.

@jsoriano jsoriano requested a review from a team December 1, 2023 10:33
@jsoriano jsoriano self-assigned this Dec 1, 2023
Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

Thanks

internal/packages/conditions.go Outdated Show resolved Hide resolved
Co-authored-by: Mario Rodriguez Molins <marrodmo@gmail.com>
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @jsoriano

@jsoriano jsoriano merged commit 5329f5e into elastic:main Dec 4, 2023
4 checks passed
@jsoriano jsoriano deleted the strings-cut branch December 4, 2023 12:09
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.

3 participants