Skip to content

fix: E2 MustSetRandom all elements#793

Merged
yelhousni merged 2 commits intomasterfrom
fix/field-e2-mustsetrandom
Jan 12, 2026
Merged

fix: E2 MustSetRandom all elements#793
yelhousni merged 2 commits intomasterfrom
fix/field-e2-mustsetrandom

Conversation

@ivokub
Copy link
Copy Markdown
Collaborator

@ivokub ivokub commented Jan 9, 2026

Description

MustSetRandom only set A0 value to random, not both.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Note

Fixes incomplete randomization in E2.MustSetRandom by invoking SetRandom() (randomizes both A0 and A1).

  • Updates E2.MustSetRandom in field/{babybear,goldilocks,koalabear}/extensions/e2.go
  • Aligns internal/generator/field/template/extensions/e2.go.tmpl to generate the corrected behavior
  • No other functional changes

Written by Cursor Bugbot for commit ddeec3c. This will update automatically on new commits. Configure here.

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 fixes a bug in the E2.MustSetRandom() method where only the A0 field was being set to a random value instead of both A0 and A1 fields. The fix changes the implementation to call z.SetRandom() which correctly randomizes both fields.

Key changes:

  • Updated the template file that generates E2 extension field implementations
  • Regenerated all three affected field implementations (babybear, goldilocks, koalabear)

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/generator/field/template/extensions/e2.go.tmpl Fixed template to call z.SetRandom() instead of z.A0.SetRandom()
field/koalabear/extensions/e2.go Generated file updated with the template fix
field/goldilocks/extensions/e2.go Generated file updated with the template fix
field/babybear/extensions/e2.go Generated file updated with the template fix

@yelhousni yelhousni merged commit 37b4567 into master Jan 12, 2026
20 checks passed
@yelhousni yelhousni deleted the fix/field-e2-mustsetrandom branch January 12, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants