Skip to content

refactor: replace []byte(fmt.Sprintf) with fmt.Appendf - #3468

Open
gophersg wants to merge 1 commit into
evstack:mainfrom
gophersg:main
Open

gophersg wants to merge 1 commit into
evstack:mainfrom
gophersg:main

Conversation

@gophersg

@gophersg gophersg commented Oct 9, 2026 •

Copy link
Copy Markdown

Overview

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

Summary by CodeRabbit

  • Tests
    • Updated how test data is constructed. The generated values and test assertions remain unchanged, so this update does not affect application behavior.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 193c5df2-4125-4b17-89d2-4239db483fc7
📥 Commits

Reviewing files that changed from the base of the PR and between 91f30ac and e5dc83c.

📒 Files selected for processing (1)
  • pkg/sequencers/single/queue_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

Four test-data constructions in the single sequencer queue tests now use fmt.Appendf instead of converting formatted strings to byte slices. The generated transaction values and assertions remain unchanged.

Changes

Queue test updates

Layer / File(s) Summary
Test transaction formatting
pkg/sequencers/single/queue_test.go
The test helper and queue test cases use fmt.Appendf to construct transaction byte slices. The test values and assertions remain unchanged.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to e5dc8

The test-data formatting changes are compatible with the supported Go version and leave no material merge risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check Passed The description includes the required Overview section and explains the change, rationale, expected performance benefit, preserved functionality, and related Go issue.
Title check Passed The title is concise, uses the conventional commit format, and clearly describes the main change from []byte(fmt.Sprintf) to fmt.Appendf.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tac0turtle
tac0turtle enabled auto-merge October 9, 2026 09:23
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.54%. Comparing base (91f30ac) to head (e5dc83c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3468   +/-   ##
=======================================
  Coverage   69.54%   69.54%           
=======================================
  Files         121      121           
  Lines       12006    12006           
=======================================
+ Hits         8349     8350    +1     
+ Misses       3657     3656    -1     
Flag Coverage Δ
combined 69.54% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tac0turtle
tac0turtle added this pull request to the merge queue Oct 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 9, 2026

This branch has not been deployed

No deployments
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