refactor: replace []byte(fmt.Sprintf) with fmt.Appendf#1703
Conversation
Signed-off-by: box4wangjing <box4wangjing@outlook.com>
Time Submission Status
You can submit time with the command. Example: See available commands to help comply with our Guidelines. |
📝 WalkthroughWalkthroughThis PR replaces ChangesString Formatting Optimization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@holdex pr submit-time 5m |
Description
I modified the return statement to utilize fmt.Appendf instead of fmt.Sprintf for creating the formatted byte slice.
This change enhances performance by directly appending the formatted string to the byte slice, avoiding the need for intermediate memory allocation created by fmt.Sprintf.
The resulting code is cleaner and more efficient, maintaining the same functionality while improving resource usage.
More info can see golang/go#47579
Related Issue
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist:
Checklist Explanation:
How to Review this PR:
Additional Information:
Summary by CodeRabbit