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

refactor: replace strings.Replace with strings.ReplaceAll #978

Merged
merged 1 commit into from May 15, 2022
Merged

refactor: replace strings.Replace with strings.ReplaceAll #978

merged 1 commit into from May 15, 2022

Conversation

Juneezee
Copy link
Contributor

Replace strings.Replace(s, old, new, -1) with strings.ReplaceAll(s, old, new). strings.ReplaceAll is a wrapper function for strings.Replace, but strings.ReplaceAll is more readable and removes the hardcoded -1.

strings.ReplaceAll(s, old, new) is a wrapper function for
strings.Replace(s, old, new, -1). But strings.ReplaceAll is more
readable and removes the hardcoded -1.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Copy link
Collaborator

@blgm blgm left a comment

Choose a reason for hiding this comment

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

We know that some folks use quite old versions of go. The ReplaceAll() function was added in go1.12, which is long enough ago that this change shouldn't cause issues.

@blgm blgm merged commit 143d208 into onsi:master May 15, 2022
@blgm
Copy link
Collaborator

blgm commented May 15, 2022

Thank you @Juneezee

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.

None yet

2 participants