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

chore: enable all rules from perfsprint #8194

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mmorel-35
Copy link
Contributor

@mmorel-35 mmorel-35 commented Jan 1, 2025

Description

enable and fixes all rules from perfsprint linter

@mmorel-35 mmorel-35 force-pushed the perfsprint/strconcat branch from 8d1f7a7 to be6aebd Compare January 1, 2025 12:15
@mmorel-35 mmorel-35 changed the title chore: enable strconcat rule from perfsprint chore: enable all rules from perfsprint Jan 1, 2025
@mmorel-35 mmorel-35 force-pushed the perfsprint/strconcat branch from f3c8f15 to 7cefcc7 Compare January 1, 2025 13:03
@@ -66,7 +66,7 @@ func TestRedisCache_PutArtifact(t *testing.T) {
addr = "dummy:16379"
}

c, err := cache.NewRedisCache(fmt.Sprintf("redis://%s", addr), "", "", "", false, 0)
c, err := cache.NewRedisCache("redis://"+addr, "", "", "", false, 0)
Copy link
Collaborator

@knqyf263 knqyf263 Jan 6, 2025

Choose a reason for hiding this comment

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

I feel like it's too much. `fmt.Sprintf is easier to read than string concatenation, even with a performance downside. However, if it drastically improves performance, it's worth considering.

# Optimizes into strings concatenation.
strconcat: false
strconcat: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

I personally prefer not to use this optimization.

Suggested change
strconcat: true
strconcat: false

@DmitriyLewen @simar7 @nikpivkin However, if you prefer string concatenation, I'm okay with that.

Copy link
Member

Choose a reason for hiding this comment

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

I would also vote not to use this. fmt.Sprintf seems fine to me. Is this subjective or there's something on the table w.r.t. performance by using this?

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