Skip to content

Conversation

abice
Copy link
Owner

@abice abice commented Jul 22, 2025

Fixes #260

This pull request introduces a new AppendText method to multiple enum types across the codebase. This method appends the textual representation of the enum to a byte slice and is implemented consistently across all affected types. Additionally, tests and snapshot updates are included to verify and document the changes.

New AppendText Method Implementations:

  • Added AppendText method to the following types:
    • Color in example/color_enum.go
    • Commented and ComplexCommented in example/commented_enum.go [1] [2]
    • Make, NoZeros in example/example_enum.go [1] [2]
    • Shop in example/replace_prefix_enum.go
    • IntShop in example/replace_prefix_int_enum.go
    • ProjectStatus in example/sql_enum.go
    • StrState in example/strings_only_enum.go

Testing Enhancements:

  • Added a new test TestColorAppendText to validate the behavior of the AppendText method for the Color type in example/color_test.go. This test ensures the method produces the correct output and matches the behavior of MarshalText and String.

Snapshot Updates:

  • Updated snapshots in generator/.snapshots to reflect the addition of the AppendText method for various enum types:

@abice abice force-pushed the abice/textAppender branch from cdacea5 to 4e5c845 Compare July 22, 2025 02:41
@coveralls
Copy link

coveralls commented Jul 22, 2025

Coverage Status

coverage: 94.059%. remained the same
when pulling 4e5c845 on abice/textAppender
into c8900b3 on master.

@abice abice merged commit c68da2e into master Jul 22, 2025
8 checks passed
@abice abice deleted the abice/textAppender branch July 22, 2025 02:43
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.

golang 1.24 compatibility - generate encoding.TextAppender
2 participants