* ci: update golangci-lint configuration and lint settings
- Update golangci-lint to version 2
- Enable new linters and adjust existing ones
- Update lint settings across multiple test files
- Remove unused struct and variable checks
- Add new lint exclusions for generated code and specific directories
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* ci(github): update golangci-lint-action to v8 and lint version to v2.3.4
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* ci: downgrade golangci-lint to v2.1.6
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* ci(golangci): add gofumpt linter and fix related issues- Added gofumpt linter to .golangci.yml
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* test: ignore testifylint and gofumpt lints in specific test cases
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* build(deps): remove golang.org/x/lint
- Remove golang.org/x/lint package from go.mod
- Update related dependencies in go.sum
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
* build(deps): downgrade golang.org/x/mod and golang.org/x/tools
- Downgrade golang.org/x/mod from v0.24.0 to v0.18.0
- Downgrade golang.org/x/tools from v0.33.0 to v.22.0
These changes are made to address compatibility issues with the current project setup.
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
---------
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
- Use specified default value in struct tags when binding a request input to struct for validation, even if sent empty, not only when not sent at all.
- Add string field to `TestMappingDefault` test case.
- Add test case for not sent form field to default to the value specified via code.
- Add test case for form field sent empty to default to the value specified via code.
Fixes: How to apply default value if empty value provided by client during model binding? #4042, #13042df, #a41721a
* feat(form): add array collection format in form binding
* feat(form): add array collection format in form binding
* test(form): fix test code for array collection format in form binding
* fix(binding): support application/yaml
RFC 9512 defines application/yaml as the official YAML MIME type.
application/x-yaml is deprecated. In this commit, we ensure it is
recognized correctly in Content-Type.
* fix(render): use application/yaml when rendering YAML
As per RFC 9512, application/x-yaml is now deprecated and applications
should use application/yaml. This commit fix the Content-Type header
when rendering YAML.
The pointer support in url query params (using []*Struct for binding query params) was previously available in Gin, but was removed in commit 0d50ce8 since there wasn't a test case for such a scenario, and so the case block was removed as a redundant one.
* feat(binding): support custom struct tag
Add function `binding.MapFormWithTag` (#2719)
* doc: add 'bind form-data with custom struct tag'
Add 'Bind form-data request with custom struct and custom tag' section (#2719)
* test(binding): add test for MapFromWithTag