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

Use fmt.Sprintf instead of string concatenate #361

Closed
mxyng opened this issue Sep 29, 2021 · 0 comments · Fixed by #727
Closed

Use fmt.Sprintf instead of string concatenate #361

mxyng opened this issue Sep 29, 2021 · 0 comments · Fixed by #727
Assignees
Labels
kind/maintenance A change related to the maintenance of the project.

Comments

@mxyng
Copy link
Collaborator

mxyng commented Sep 29, 2021

While fmt.Sprintf() may be less performant than string concatenate, it's a nicer reading experience. At our current scale, the performance hit shouldn't be relevant. For logging purposes though, we should be using the zap.Logger.Sugar().Infof() instead since should evaluate the log statement unless it's configured to log; fmt.Sprintf() will evaluate the string regardless of the log level which means it could be doing unnecessary work.

@mxyng mxyng added the kind/maintenance A change related to the maintenance of the project. label Sep 29, 2021
@BruceMacD BruceMacD self-assigned this Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/maintenance A change related to the maintenance of the project.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants