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

Enable perfsprint linter and fix up code issues #14091

Merged
merged 1 commit into from
May 15, 2024

Conversation

alexandear
Copy link
Contributor

This PR enables perfsprint linter and fixes its issues.

Changes that improve both readability and performance are:

  • replace fmt.Sprintf("%d", x), fmt.Sprint(x) with strconv.Itoa(x) for int values;
  • replace fmt.Sprintf("%t", b) with strconv.FormatBool(b) for bool values;
  • replace fmt.Sprintf("%d", x) with strconv.FormatInt for int64 values;
  • replace fmt.Sprintf("%d", x) with strconv.FormatUint for uint64 values;
  • remove redundant fmt.Sprint statements.

Copy link
Member

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

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

Looks good, just wondering about the text entry in .golangci.yml.

.golangci.yml Show resolved Hide resolved
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
@beorn7 beorn7 merged commit 806073a into prometheus:main May 15, 2024
25 checks passed
@alexandear alexandear deleted the enable-perfsprint-linter branch May 15, 2024 15:48
@machine424
Copy link
Collaborator

Thanks @alexandear for this and @beorn7 for the review.

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

3 participants