Skip to content

Remove unnecessary []byte casts in pkg/console golden tests#24086

Merged
pelikhan merged 2 commits intomainfrom
copilot/remove-bytetype-casts-in-golden-tests
Apr 2, 2026
Merged

Remove unnecessary []byte casts in pkg/console golden tests#24086
pelikhan merged 2 commits intomainfrom
copilot/remove-bytetype-casts-in-golden-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

golden.RequireEqual is generic over []byte | string, but all call sites in pkg/console/golden_test.go were converting strings to []byte before passing them — causing needless allocations with no benefit.

Changes

  • pkg/console/golden_test.go: Removed 6 []byte(...) casts, passing string values directly to golden.RequireEqual
// Before
golden.RequireEqual(t, []byte(output))
golden.RequireEqual(t, []byte(fullOutput.String()))

// After
golden.RequireEqual(t, output)
golden.RequireEqual(t, fullOutput.String())

Copilot AI changed the title [WIP] Remove unnecessary []byte casts in golden tests Remove unnecessary []byte casts in pkg/console golden tests Apr 2, 2026
Copilot AI requested a review from pelikhan April 2, 2026 12:06
@pelikhan pelikhan marked this pull request as ready for review April 2, 2026 12:07
Copilot AI review requested due to automatic review settings April 2, 2026 12:07
@pelikhan pelikhan merged commit 0e99fac into main Apr 2, 2026
52 checks passed
@pelikhan pelikhan deleted the copilot/remove-bytetype-casts-in-golden-tests branch April 2, 2026 12:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies pkg/console golden tests by removing redundant []byte(...) casts and passing string outputs directly to golden.RequireEqual, avoiding unnecessary conversions/allocations at the call sites.

Changes:

  • Updated 6 golden.RequireEqual call sites to pass string values directly instead of []byte(...) casts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

[plan] Remove unnecessary []byte casts in pkg/console golden tests

3 participants