Skip to content

Enable perfsprint linter and fix up code#13220

Closed
alexandear wants to merge 1 commit intoprometheus:mainfrom
alexandear:enable-perfsprint-linter
Closed

Enable perfsprint linter and fix up code#13220
alexandear wants to merge 1 commit intoprometheus:mainfrom
alexandear:enable-perfsprint-linter

Conversation

@alexandear
Copy link
Copy Markdown
Contributor

This PR enables perfsprint linter and fixes its issues.

Changes that improves 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.

@machine424
Copy link
Copy Markdown
Member

Hello,
Any reason why this was closed?

@alexandear
Copy link
Copy Markdown
Contributor Author

@machine424 Hello,

Apologies for any inconvenience caused. The pull request was closed because it's been open for quite a long period, specifically six months, without any reviews or further actions taken. If the information within the pull request is still pertinent and relevant, I can to reopen it.

@machine424
Copy link
Copy Markdown
Member

Yes, I think we can give this linter a try, it can help avoid regressions after changes like #13669. Thanks.

(Maybe there is a glitch or sth, but I see that the PR was opened in 29/11/2023 and closed on the same day)

@alexandear
Copy link
Copy Markdown
Contributor Author

@machine424 I created a new PR #14091, because it's not possible to re-open this due to the deleted fork.

(Maybe there is a glitch or sth, but I see that the PR was opened in 29/11/2023 and closed on the same day)

Yes, you're correct. I got confused and provided the wrong reason for closing this PR. The correct reason is as follows: perfsprint was first introduced in golangci-lint v1.55.0, but 6 months ago the Prometheus repo was using v1.54.2. Therefore, I chose not to upgrade the golangci-lint version due to the minor changes.

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