1889 Commits

Author SHA1 Message Date
s.solodyagin 8e7d9dc779 Merge tag 'tags/v1.11.0' v1.11.0 2025-10-14 13:53:17 +03:00
Bo-Yi Wu 6ad6205e9c docs(changelog): upgrade Gin to v1.11.0 and add release notes (#4361)
- Add release notes for Gin v1.11.0, detailing new features, enhancements, bug fixes, CI/build improvements, dependency updates, and documentation changes
- Update Gin framework version to v1.11.0

ref: https://github.com/gin-gonic/gin/issues/4325

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-09-20 19:38:42 +08:00
Bo-Yi Wu 7858527c8c docs(changelog): update release notes for Gin v1.10.1 (#4360)
- Add release notes for Gin v1.10.1, including new features, enhancements, and build process updates

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-09-20 19:32:43 +08:00
Bo-Yi Wu cb000f570c ci: integrate Trivy vulnerability scanning into CI workflow (#4359)
- Add a GitHub Actions job for vulnerability scanning using Trivy
- Configure Trivy to scan the repository for vulnerabilities of severity critical, high, and medium
- Ensure the workflow fails if vulnerabilities are found

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-09-20 19:24:57 +08:00
Flc゛ 2119046230 ci: support Go 1.25 (#4341)
- Update GitHub Actions workflow to include Go 1.25 in the test matrix
- This change expands the range of Go versions tested for the project

Signed-off-by: Flc <four_leaf_clover@foxmail.com>
2025-09-19 09:44:22 +08:00
Flc゛ da372fc778 build(deps): upgrade github.com/bytedance/sonic from v1.13.2 to v1.14.0 (#4342)
* build(deps): upgrade github.com/bytedance/sonic from v1.13.2 to v1.14.0

Signed-off-by: Flc <four_leaf_clover@foxmail.com>

* build(deps): upgrade github.com/bytedance/sonic from v1.13.2 to v1.14.0

Signed-off-by: Flc <four_leaf_clover@foxmail.com>

* test: update expected status code for request too large test

Signed-off-by: Flc <four_leaf_clover@foxmail.com>

---------

Signed-off-by: Flc <four_leaf_clover@foxmail.com>
2025-09-19 08:40:33 +08:00
Name e198f6e859 refactor(render): remove headers parameter from writeHeader (#4353)
Co-authored-by: 1911860538 <alxps1911@gmail.com>
2025-09-19 08:39:17 +08:00
dependabot[bot] cca98d2d26 chore(deps): bump google.golang.org/protobuf from 1.36.8 to 1.36.9 (#4356)
Bumps google.golang.org/protobuf from 1.36.8 to 1.36.9.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-version: 1.36.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-19 08:35:54 +08:00
Name 9b1e3533e2 refactor(tree): replace string(/) with "/" in node.insertChild (#4354)
Co-authored-by: 1911860538 <alxps1911@gmail.com>
2025-09-19 08:35:34 +08:00
Name f9bd00a6b7 perf(context): optimize getMapFromFormData performance (#4339)
Co-authored-by: 1911860538 <alxps1911@gmail.com>
2025-09-14 07:29:11 +08:00
dependabot[bot] 28172fa682 chore(deps): bump google.golang.org/protobuf from 1.36.6 to 1.36.8 (#4346)
Bumps google.golang.org/protobuf from 1.36.6 to 1.36.8.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-version: 1.36.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-14 07:26:29 +08:00
dependabot[bot] 46150257b3 chore(deps): bump github.com/stretchr/testify from 1.10.0 to 1.11.1 (#4347)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.10.0 to 1.11.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.10.0...v1.11.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-version: 1.11.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-14 07:26:06 +08:00
dependabot[bot] e7693e67c2 chore(deps): bump actions/setup-go from 5 to 6 (#4351)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5 to 6.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-14 07:25:36 +08:00
dependabot[bot] 077a2f39c8 chore(deps): bump github.com/quic-go/quic-go from 0.53.0 to 0.54.0 (#4328)
Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.53.0 to 0.54.0.
- [Release notes](https://github.com/quic-go/quic-go/releases)
- [Commits](https://github.com/quic-go/quic-go/compare/v0.53.0...v0.54.0)

---
updated-dependencies:
- dependency-name: github.com/quic-go/quic-go
  dependency-version: 0.54.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-06 22:16:53 +08:00
Name 45b805f6d5 perf(recovery): optimize the log output of CustomRecoveryWithWriter (#4258)
Co-authored-by: 1911860538 <alxps1911@gmail.com>
2025-08-02 12:30:14 +08:00
Varus Hsu 17d0b553ea chore(render): do not export tomlContentType anymore (#4319) 2025-08-02 12:27:59 +08:00
諏訪原慶斗 42f93283cf docs(test): improved GoDoc in test_helpers.go (#4270) 2025-08-02 12:23:20 +08:00
諏訪原慶斗 32065bbd42 chore(response): prevention of Hijack() runtime panics (#4295)
* Prevention of Hijack() runtime panics

* added test of Hijack()

* fix review

* fix lint error

* added check assertion of Wrrten() condition before calling Hijack()
2025-08-02 12:16:58 +08:00
Denny Septian Panggabean b987b6206f build: make automatically update package in golang (#4311) 2025-07-26 21:02:59 +08:00
Leon cap dab5944a7b test(context): add comprehensive unit tests for Context.File() method (#4307)
* test: add comprehensive unit tests for Context.File() method

- Add TestContextFile with multiple test scenarios in context_test.go
- Add simplified tests in context_file_test.go
- Cover file serving, 404 handling, directory access, HEAD requests, and Range requests
- All tests pass successfully

* fix: resolve gci formatting issues in test files

* fix: correct test file paths and add test file to gin directory

* move test_file.txt to testdata directory as suggested by maintainer

* fix: update test file paths to use testdata directory
2025-07-22 21:38:32 +08:00
Name 9708475b3b docs(context): fix AbortWithStatusPureJSON comment typo (#4310)
Co-authored-by: 1911860538 <alxps1911@gmail.com>
2025-07-22 21:36:47 +08:00
Name e4c2a27624 refactor(context): remove unused Context dependency in get method (#4304)
Co-authored-by: 1911860538 <alxps1911@gmail.com>
2025-07-22 11:19:08 +08:00
chenhuiluo a4ac275e07 test(route): add some test for routergroup (#4291)
Co-authored-by: chenhuiluo <luochenhui@butterfly.tech>
2025-07-19 15:49:41 +08:00
dependabot[bot] ae5be7fcb7 chore(deps): bump golang.org/x/net from 0.41.0 to 0.42.0 (#4297)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.41.0 to 0.42.0.
- [Commits](https://github.com/golang/net/compare/v0.41.0...v0.42.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.42.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-19 15:08:22 +08:00
maskpp 57ec9e6036 chore(mode): remove impossible case (empty value for mode) (#4303) 2025-07-19 15:07:44 +08:00
Leon cap ad4f436ae9 docs: correct article usage in comments (#4301)
- Fix 'an url' to 'a URL' in logger.go comment
- Fix 'an form' to 'a form' in binding/form_mapping.go comment
- Improve grammar consistency in code documentation
2025-07-19 14:58:12 +08:00
諏訪原慶斗 5826722a87 fix: version number discrepancy (#4299) 2025-07-17 19:51:40 +08:00
諏訪原慶斗 bdc1ad7987 docs: added comment in doc.go (#4274) 2025-07-13 09:43:32 +08:00
dependabot[bot] 545fd74379 chore(deps): bump github.com/go-playground/validator/v10 (#4289)
Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.26.0 to 10.27.0.
- [Release notes](https://github.com/go-playground/validator/releases)
- [Commits](https://github.com/go-playground/validator/compare/v10.26.0...v10.27.0)

---
updated-dependencies:
- dependency-name: github.com/go-playground/validator/v10
  dependency-version: 10.27.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-13 09:41:58 +08:00
dependabot[bot] a6287825c9 chore(deps): bump github.com/ugorji/go/codec from 1.2.12 to 1.3.0 (#4268)
Bumps [github.com/ugorji/go/codec](https://github.com/ugorji/go) from 1.2.12 to 1.3.0.
- [Release notes](https://github.com/ugorji/go/releases)
- [Commits](https://github.com/ugorji/go/compare/v1.2.12...codec/v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/ugorji/go/codec
  dependency-version: 1.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-13 09:41:31 +08:00
Denny Septian Panggabean dbd8a25150 feat: added AbortWithStatusPureJSON() in Context (#4290)
* feat: added `AbortWithStatusPureJSON()` in context

* Update context_test.go
2025-07-13 09:40:35 +08:00
dependabot[bot] b7d6308bcc chore(deps): bump github.com/quic-go/quic-go from 0.52.0 to 0.53.0 (#4281)
Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.52.0 to 0.53.0.
- [Release notes](https://github.com/quic-go/quic-go/releases)
- [Commits](https://github.com/quic-go/quic-go/compare/v0.52.0...v0.53.0)

---
updated-dependencies:
- dependency-name: github.com/quic-go/quic-go
  dependency-version: 0.53.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-13 09:27:07 +08:00
Denny Septian Panggabean 4bdcd9d0f1 docs: added available ID documentation (#4287) 2025-07-13 09:26:26 +08:00
s.solodyagin ed522975dd update deps 2025-07-09 14:56:49 +03:00
s.solodyagin 135bac2404 Merge remote-tracking branch 'upstream/master' 2025-07-09 14:40:09 +03:00
Denny Septian Panggabean 76dd08d512 docs: wrong badge workflow in README.md (#4286) 2025-07-07 17:20:47 +08:00
M. Ilham Surya Pratama cf4775283e chroe: migrate yaml package to github.com/goccy/go-yaml (#4272) 2025-06-21 12:38:28 +08:00
Tim 688a429d19 feat: support custom json codec at runtime (#3391)
* refactor(json): export json codec

* feat(json): support custom json codec at runtime

* chore(copyright): update copyright to 2025 gin core team

* docs(gin): add custom json codec examples in doc file
2025-06-16 23:16:36 +08:00
dependabot[bot] 0a864884de chore(deps): bump golang.org/x/net from 0.40.0 to 0.41.0 (#4262)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.40.0 to 0.41.0.
- [Commits](https://github.com/golang/net/compare/v0.40.0...v0.41.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.41.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-16 23:01:46 +08:00
Victor Dusart dd33ff7938 fix(docs): missing go markdown codeblock (#4266) 2025-06-16 22:59:53 +08:00
Name 77d70e5858 refactor(internal/bytesconv): replace rand usage with crypto/rand and rand.Int63 (#4259)
Co-authored-by: huangzw <huangzw@2345.com>
2025-06-09 21:05:34 +08:00
eqsdxr a9c5b36578 docs: small changes (#4261) 2025-06-09 21:04:23 +08:00
OHZEKI Naoki e30123ad73 refactor(recovery): extract Authorization header masking into maskAuthorization func (#4143)
* refactor(recovery): extract Authorization header masking into maskAuthorization func

* test(recovery): Add a test for maskAuthorization
2025-06-02 12:38:19 +08:00
Name 3c12d2a80e perf(recover): replace bytes with strings in function for better performance (#4252)
Co-authored-by: huangzw <huangzw@2345.com>
2025-05-31 08:41:13 +08:00
dependabot[bot] 61c2b1c28f chore(deps): bump github.com/quic-go/quic-go from 0.51.0 to 0.52.0 (#4250)
Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.51.0 to 0.52.0.
- [Release notes](https://github.com/quic-go/quic-go/releases)
- [Commits](https://github.com/quic-go/quic-go/compare/v0.51.0...v0.52.0)

---
updated-dependencies:
- dependency-name: github.com/quic-go/quic-go
  dependency-version: 0.52.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-27 20:27:26 +08:00
Flc゛ 41d8591eb1 refactor(context): refactor Keys type to map[any]any (#3963)
* refactor(context): refactor keys to `map[any]any`

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>

* refactor(context): refactor keys to `map[any]any`

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>

* style(context): remove empty lines before GetInt16, GetIntSlice, and GetStringMapString methods

- Remove unnecessary empty lines in the context.go file
- Improve code readability and consistency

Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>

* refactor(context): simplify GetStringSlice function

- Replace manual type assertion with generic getTyped function
- Reduce code duplication and improve type safety

Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>

* test(context): improve context.Set and context.Get tests

- Split existing test into separate functions for different scenarios
- Add test for setting and getting values with any key type
- Add test for handling non-comparable keys
- Improve assertions to check for key existence and value correctness

Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>

* refactor(context): replace fmt.Errorf with fmt.Sprintf in panic message

* test(context): remove trailing hyphen from context_test.go

* refactor(context): improve error message for missing key in context

- Remove unnecessary quotes around the key in the error message
- Simplify the error message format for better readability

* test(context): improve panic test message for non-existent key

---------

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
2025-05-26 23:15:14 +08:00
Flc゛ 848e1cdd0d refactor: replace interface{} with any in type declarations (#4249)
- Update golangci.yml to use 'any' instead of 'interface{}' in gofmt
- Modify debug.go, plain.go, and render_test.go to use 'any' type
- Improve code readability and follow modern Go conventions

Signed-off-by: Flc <four_leaf_clover@foxmail.com>
2025-05-26 23:11:05 +08:00
Flc゛ c8af82af15 test(context): add cleanup for uploaded file in SaveUploadedFile test (#4248)
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
2025-05-25 20:38:39 +08:00
Alessandro (Ale) Segala 40725d85ba chore(bind): return 413 status code when error is http.MaxBytesError (#4227)
* Bind: return 413 status code when error is `http.MaxBytesError`

The Go standard library includes a method `http.MaxBytesReader` that allows limiting the request body. For example, users can create a middleware like:

```go
func MiddlewareMaxBodySize(c *gin.Context) {
	// Limit request body to 100 bytes
	c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, 100)
	c.Next()
}
```

When the body exceeds the limit, reading from the request body returns an error of type `http.MaxBytesError`.

This PR makes sure that when the error is of kind `http.MaxBytesError`, Gin returns the correct status code 413 (Request Entity Too Large) instead of a generic 400 (Bad Request).

* Disable test when using sonic

* Fix

* Disable for go-json too

* Add references to GitHub issues

* Test that the response is 400 for sonic and go-json
2025-05-25 20:36:33 +08:00
Flc゛ c4287b1300 ci(golangci-lint): update configuration and fix lint issues (#4247)
* 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>
2025-05-23 14:46:48 +08:00