65 Commits

Author SHA1 Message Date
ee24da4e72 refactor: interface{} to any and reflect.Ptr to reflect.Pointer (#4395)
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]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L31-R31)
[[2]](diffhunk://#diff-6c19859cb32c7516ea95ddc8f8235460818eb2f24d2204308e0d9e1b19e7d90fL15-R19)
[[3]](diffhunk://#diff-a15ba2f5e830b4833c47b902515a4f9e5a4f83a3707698f3229b307ec3776b41L15-R18)
[[4]](diffhunk://#diff-52e0837e84d49221d1b810d88fdf78221f36cffcd664fb42f8aba49a79b974dcL15-R19)
[[5]](diffhunk://#diff-11c3457d1a23a4ca6ecd00d6b856289774936b6a708384cf03aff164044e7546L15-R19)
[[6]](diffhunk://#diff-2cff9cf8e6a0cc34087326d8c8149c3bbaf74c76fdbdf5a73daed13cc04249e1L15-R19)
* 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]](diffhunk://#diff-175edfeea54490b8fe4e18ffcbea5835efaf8f0b8acf623359073987cae7eb76L48-R55)
[[2]](diffhunk://#diff-2b1953fb78cf3593d8c2c7d911e95b65fd0b847c30ed0b4d167d16fe6d781235L54-R74)
[[3]](diffhunk://#diff-e001b7a4b63603b9b14f00de78a4d570bb76c5f57d856a24643f071032e12356L66-R73)
[[4]](diffhunk://#diff-5582954e8a9983988dc8854ad82067fb2ac6269b988e07357ad8db1dfec5f1a0L39-R41)
[[5]](diffhunk://#diff-c5d51d56f487779a2b6207c7ad26c7a20bbadcc846ce094fe60ab4cabff58c51L107-R107)
[[6]](diffhunk://#diff-f96e6a9fdb416eb1804ceaba1fe0ac637bff22c43837f8bb849c2366ce72d4a1L116-R121)
[[7]](diffhunk://#diff-f94c83a1b08ae060d9346f4a6031fc4a7b9a0b894e02d9afaa09018b6598eac0L112-R112)
[[8]](diffhunk://#diff-748b11dbe8828dd4c040ec23cae0b8fe57ecf0a2d1b7694ea39102294e633c64L36-R36)
[[9]](diffhunk://#diff-748b11dbe8828dd4c040ec23cae0b8fe57ecf0a2d1b7694ea39102294e633c64L74-R74)
[[10]](diffhunk://#diff-748b11dbe8828dd4c040ec23cae0b8fe57ecf0a2d1b7694ea39102294e633c64L96-R96)

**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]](diffhunk://#diff-6c19859cb32c7516ea95ddc8f8235460818eb2f24d2204308e0d9e1b19e7d90fL15-R19)
[[2]](diffhunk://#diff-a15ba2f5e830b4833c47b902515a4f9e5a4f83a3707698f3229b307ec3776b41L15-R18)
[[3]](diffhunk://#diff-52e0837e84d49221d1b810d88fdf78221f36cffcd664fb42f8aba49a79b974dcL15-R19)
[[4]](diffhunk://#diff-11c3457d1a23a4ca6ecd00d6b856289774936b6a708384cf03aff164044e7546L15-R19)
[[5]](diffhunk://#diff-2cff9cf8e6a0cc34087326d8c8149c3bbaf74c76fdbdf5a73daed13cc04249e1L15-R19)
[[6]](diffhunk://#diff-175edfeea54490b8fe4e18ffcbea5835efaf8f0b8acf623359073987cae7eb76L48-R55)
[[7]](diffhunk://#diff-e001b7a4b63603b9b14f00de78a4d570bb76c5f57d856a24643f071032e12356L66-R73)
[[8]](diffhunk://#diff-5582954e8a9983988dc8854ad82067fb2ac6269b988e07357ad8db1dfec5f1a0L39-R41)

**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]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L31-R31)
[[2]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L52-R52)
[[3]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L62-R62)
[[4]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L73-R86)
[[5]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L96-R97)
[[6]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L107-R114)
[[7]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L124-R124)
[[8]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L135-R143)
[[9]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L167-R167)

These changes collectively modernize the codebase and prepare it for
future Go developments by using the idiomatic `any` type.
2025-08-28 16:53:19 +08:00
7ffdff37e4 chore: upgrade golangci-lint configuration and optimize codebase (#4236)
This PR includes the following changes:

- **Upgrade `.golangci.yml`**: Updated the configuration file to align
with the latest golangci-lint version, ensuring compatibility and
leveraging new features.
- **Refactor GitHub Action workflow**: Modified `golangci-lint.yml` in
the GitHub Actions workflow to reflect the updated configuration and
improve CI performance.
- **Codebase optimization**: Refactored code to address issues and
warnings raised by the updated golangci-lint rules, including:
  - Improved function length and complexity.
  - Enhanced error handling and variable naming conventions.
- Fixed minor issues such as unused imports and formatting
inconsistencies.

These changes aim to maintain code quality, ensure compatibility with
the latest tools, and improve overall maintainability.
2025-08-22 13:29:09 +08:00
bcda48bf82 fix(net/ghttp):check parameter existence to determine using default or front-end value. (#4182) 2025-03-08 20:56:27 +08:00
7d3b055d3e fix(net/ghttp): MakeBodyRepeatableRead takes not effective when called after ParseForm (#4143) 2025-02-11 18:02:26 +08:00
e1fa99013a use iota to unify the enums definition (#3305) 2024-02-06 11:44:29 +08:00
951f8921cd fix #3237 (#3267) 2024-01-17 15:35:48 +08:00
7f9467d1f8 fix: #2938 (#3178) 2023-12-20 20:25:23 +08:00
a17849bc39 improve struct converting in parameter name case sensitive scenario for package gconv (#3122) 2023-11-08 21:17:55 +08:00
53e5a04073 change minimum golang version from v1.15 to v1.18 (#2820) 2023-08-01 21:15:28 +08:00
a4762d0e02 fix issue in http proxy when repeatable reading request body content (#2666) 2023-05-25 11:56:12 +08:00
2329622564 add multiple methods support for united routes registering (#2664) 2023-05-25 10:58:06 +08:00
45e4c9e16c add tag value of in support for api definition that has meta info (#2450) 2023-03-13 19:29:30 +08:00
8dc8dd9756 fix issue #2261 (#2458) 2023-02-20 21:57:49 +08:00
1793bf0863 add golangci feature to guarantee codes quality (#2229) 2022-11-01 20:12:21 +08:00
a228495ced improve error message for package ghttp 2022-04-12 16:15:54 +08:00
e8581d4fd5 add Is/Equal/Unwrap functions for package gerror 2022-04-12 15:45:26 +08:00
1e141d9f64 improve package gjson/ghttp 2022-04-07 21:26:39 +08:00
8357b0f649 improve comment 2022-03-19 17:58:21 +08:00
073869b354 downgrade otel version from v1.3.0 to v1.0.0 2022-02-17 15:47:08 +08:00
af39eb4c9f CI update; Example update for package gcache 2022-02-08 23:13:33 +08:00
09f83bdd58 add panic for ghttp.Server.GetBody 2022-01-06 21:47:36 +08:00
ce93b625d4 change errors wrapped by gerror.Wrap with error stack info for all packages 2021-12-21 22:59:14 +08:00
9748b9f70b improve association feature for package gvalid 2021-11-23 10:42:43 +08:00
cea6e4c3d9 improve package gvalid 2021-11-22 22:43:09 +08:00
be03b3cdda Improved import, by group improt. 2021-11-13 23:23:55 +08:00
79a233eb78 example&comment update 2021-11-01 19:46:39 +08:00
8ef4f68215 add IgnoreEmptySliceWhere feature for package gdb; add OriginValueAndKind/OriginTypeAndKind functions for package internal/utils 2021-10-28 23:18:23 +08:00
fa5499373a replace char <xxx> to ;add GetWithEnv/GetWithCmd fuctions for package gcfg 2021-10-21 18:22:47 +08:00
1bc0635f8b version 2 2021-10-11 21:41:56 +08:00
993bf897cf remove deprecated functions; refract package gjson 2021-09-27 22:47:39 +08:00
df09d8c604 refract package ghttp/gredis/glog 2021-09-27 21:27:24 +08:00
727f58a24b remove usage of gconv.Unsafe* functions internally to avoid unexpected errors 2021-09-14 19:30:20 +08:00
006fb79967 improve package gjson; replace fmt.Errorf to gerror; improve examples for package gdb 2021-09-13 16:43:09 +08:00
abc8e62d58 add package gcode and improve error implements for package gerror 2021-08-24 21:18:59 +08:00
cd3593182a improve package gerror/ghttp for error code handling 2021-08-07 10:44:57 +08:00
ea0340db8e improve validation manager feature for package gvalid 2021-05-19 09:25:49 +08:00
7003c284d0 replace json.Unmarshal with json.UnmarshalUseNumber for packages 2021-05-15 22:38:07 +08:00
cc1224e032 add context for package gvalid.Check* functions 2021-05-13 20:56:52 +08:00
b06580d343 improve struct validation for package gvalid 2021-05-12 00:01:52 +08:00
78027d2ec6 deprecated comments update 2021-03-30 13:43:08 +08:00
826b9b1b1f fix issue in struct converting for package ghttp 2021-01-18 09:22:46 +08:00
093034acd1 copyright comment update 2021-01-17 21:46:25 +08:00
5c9cee7fb9 improve package gconv 2021-01-17 20:56:38 +08:00
e06b62ecf2 add default value from struct tag for ghttp.Request 2020-11-08 15:44:04 +08:00
9c3b978b50 improve package ghttp and internal/structs 2020-10-22 15:16:31 +08:00
47663aa1f1 fix issue of EOF in ghttp.Request when no data posted using form-data 2020-10-13 20:12:54 +08:00
46bdde9265 revert gvar.Var from interface to struct 2020-06-29 13:40:19 +08:00
b2aa59d893 import third-party library json-iterator to improve the performance for json operations 2020-06-17 21:16:25 +08:00
4d38b508a3 improve gvar by changig gvar.Var from type struct to interface 2020-06-16 17:38:05 +08:00
cbf465eeea improve body interface implements for ghttp.Reqest/Response 2020-06-06 13:34:58 +08:00