Skip to content

refactor: interface{} to any and reflect.Ptr to reflect.Pointer#4395

Merged
hailaz merged 11 commits intomasterfrom
fix/any
Aug 28, 2025
Merged

refactor: interface{} to any and reflect.Ptr to reflect.Pointer#4395
hailaz merged 11 commits intomasterfrom
fix/any

Conversation

@hailaz
Copy link
Contributor

@hailaz hailaz commented Aug 28, 2025

This pull request standardizes the use of the Go 1.18+ any type alias instead of interface{} throughout the codebase. The change improves code readability and aligns with modern Go best practices. The update touches many files, including core data structures, code generation templates, logging utilities, and test data, ensuring consistency across all usages.

Type alias migration to any:

  • Replaced all instances of interface{} with any in core data structures such as garray and in generated model structs (e.g., TableUser, User1, User2) to modernize type usage. [1] [2] [3] [4] [5] [6]
  • Updated function signatures, method parameters, and return types from interface{} to any in various parts of the codebase, including code generation, service logic, and logging utilities (e.g., mlog). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Generated code and templates:

  • Adjusted generated files and code generation templates to output any instead of interface{} for relevant struct fields and function signatures, ensuring that new code generation aligns with the updated convention. [1] [2] [3] [4] [5] [6] [7] [8]

Container and utility updates:

  • Refactored the garray container implementation and related constructors/methods to use []any instead of []interface{}, along with corresponding function signatures. [1] [2] [3] [4] [5] [6] [7] [8] [9]

These changes collectively modernize the codebase and prepare it for future Go developments by using the idiomatic any type.

@hailaz hailaz requested a review from houseme August 28, 2025 07:11
@hailaz hailaz merged commit ee24da4 into master Aug 28, 2025
25 checks passed
@hailaz hailaz deleted the fix/any branch August 28, 2025 08:53
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