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

strings.TrimRight is used instead of TrimSuffix #507

Closed
GrosQuildu opened this issue Apr 18, 2023 · 1 comment · Fixed by #618
Closed

strings.TrimRight is used instead of TrimSuffix #507

GrosQuildu opened this issue Apr 18, 2023 · 1 comment · Fixed by #618

Comments

@GrosQuildu
Copy link

GrosQuildu commented Apr 18, 2023

This line aims to remove " kB" suffix, but instead removes all characters from " kB" cutset.

v = strings.TrimRight(v, " kB")

Similar fix as was done in this commit is required - b3d77ec .

@discordianfish
Copy link
Member

Oops, thanks! Wanna submit a quick PR to fix this?

rexagod added a commit to rexagod/procfs that referenced this issue Mar 21, 2024
Use `TrimSuffix` instead of `TrimRight` in cases where an exact suffix
string needs to be removed, not all occurrences of all characters in a
specified cutset.

Fixes: prometheus#507

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
SuperQ pushed a commit that referenced this issue May 12, 2024
Use `TrimSuffix` instead of `TrimRight` in cases where an exact suffix
string needs to be removed, not all occurrences of all characters in a
specified cutset.

Fixes: #507

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
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 a pull request may close this issue.

2 participants