45 Commits

Author SHA1 Message Date
İsmail Daşcı
fc23a46a1e feat: add warning for multiple response body writes
Add a debug warning when attempting to write to the response body
multiple times. This helps developers identify subtle bugs where
middleware or handlers inadvertently write responses multiple times,
resulting in invalid output (e.g., concatenated JSON objects).

This change:
- Adds a warning in Context.Render() when Writer.Written() is true
- Follows the existing pattern used for header write warnings
- Only shows in debug mode via debugPrint()
- Is non-breaking and backward compatible

Fixes #4477

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:41:36 +03:00
OHZEKI Naoki
19b877fa50
test(debug): improve the test coverage of debug.go to 100% (#4404) 2025-12-05 11:18:08 +08:00
Bo-Yi Wu
5dd833f1f2
chore: bump minimum Go version to 1.24 and update workflows (#4388)
- Update minimum required Go version from 1.23 to 1.24 throughout documentation, warnings, and tests
- Remove Go 1.23 from the GitHub Actions workflow matrix
- Change single quotes to double quotes for consistency in workflow configuration

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2025-10-08 08:30:45 +08:00
Bo-Yi Wu
90cf460269
chore: update Go versions and dependencies for improved compatibility (#4187)
* chore: update Go versions and dependencies for improved compatibility

- Update Go versions in workflow file to `1.23` and `1.24`
- Enhance test tags in workflow with specific linker flags
- Remove the conditional formatting step for Go `1.22.x` in workflow
- Remove `goimports` settings from `.golangci.yml`
- Update `go.mod` to use Go `1.23.0`
- Upgrade `github.com/bytedance/sonic` from `v1.11.6` to `v1.13.1`
- Update indirect dependencies `sonic/loader` to `v0.2.4` and `base64x` to `v0.1.5` in `go.mod`

Signed-off-by: appleboy <appleboy.tw@gmail.com>

* chore: update project for Go 1.23 compatibility and documentation fixes

- Update Go version requirement from 1.22 to 1.23 in README.md
- Remove superfluous `$` from example command in README.md
- Update warning message to reflect new Go version requirement in debug.go
- Update test assertion to reflect new Go version requirement in debug_test.go

Signed-off-by: appleboy <appleboy.tw@gmail.com>

---------

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-03-20 10:13:47 +08:00
Bo-Yi Wu
3f818c3fa6
chore(security): upgrade quic-go version to 0.48.2 (#4127)
- Update Go versions in GitHub Actions workflow to `1.22` and `1.23`
- Update README to require Go version `1.22` or above
- Adjust table formatting in README for better alignment
- Update warning message in `debug.go` to reflect Go version `1.22`
- Update test in `debug_test.go` to reflect Go version `1.22`
- Update `go.mod` to require Go version `1.22`
- Update dependencies in `go.mod` to newer versions

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-12-30 11:40:37 +08:00
Matthieu MOREL
e8d34d053f
ci(lint): enable usestdlibvars linter (#4091)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-11-15 23:52:16 +08:00
Matthieu MOREL
5f55c6a711
ci(lint): enable testifylint linter (#4010)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-07-14 20:33:08 +08:00
Bo-Yi Wu
7e298066ba
build: update Gin minimum Go version to 1.21 (#3960)
* build: update Gin minimum Go version to 1.21

- Update the minimum Go version requirement for Gin from `1.20` to `1.21` in both `debug.go` and `debug_test.go`
- Modify the warning message to reflect the new minimum Go version requirement in `debug.go`
- Adjust the test assertion to match the updated warning message in `debug_test.go`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* docs: refine project documentation and CI configurations

- Update supported Go versions for GitHub actions to `1.21` and `1.22`
- Specify the required Go version as `1.21` or above in README
- Change code block syntax to `sh` in installation and demo run instructions
- Remove empty lines in README sections
- Update project list formatting without changing the content

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-09 13:45:03 +08:00
Bo-Yi Wu
b1c1e7b572
ci: update Go version requirements and remove test files (#3957)
- Update the Go version requirements in `.github/workflows/gin.yml`
- Remove test files for Go versions 1.18 and 1.19
- Update the required Go version in `debug.go` and `debug_test.go`
- Rename and modify files related to Go version 1.19 and 1.20 in the `internal/bytesconv` directory

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-08 10:14:42 +08:00
thinkerou
1e1f0b1e76
chore: support min go version 1.18 (#3511)
* chore: min go version 1.18

* fix build tag error

* remove build tag

* fix word

* remove any.go

* replace interface{} instead of any
2023-03-01 10:03:48 +08:00
hopehook
b2d4185eec
Replace bytes.Buffer with strings.Builder where appropriate (#3347)
To build strings more efficiently, use strings.Builder instead.
2023-01-20 09:51:42 +08:00
mstmdev
fa58bff301
chore(dep): Changes minimum support go version to go1.16 (#3361) 2022-10-16 09:32:28 +08:00
mstmdev
088cdd74d4
Fix the value of ginSupportMinGoVer constant by semantic (#3221) 2022-07-01 10:31:31 +08:00
thinkerou
6de2245e62
switch min version of go to 1.15 (#3211) 2022-06-27 07:11:41 +08:00
thinkerou
4b68a5f12a
chore: update go.mod and remove space from copyright (#3158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-28 10:42:28 +08:00
thinkerou
62265c893c
chore: support min version of go: 1.14 (#2964) 2022-03-21 10:51:17 +08:00
thinkerou
ee4de846a8
Remove go1.12 support (#2679)
* Revert "Adding ppc64le architecture support on travis-ci (#2538)"

This reverts commit fca3f95d7cdfdef203c78f220b84118f44590512.

* not support go1.12

* fix

* Update errors_test.go

* Update debug.go
2021-04-12 00:29:34 +08:00
Qt
f4bc259de3
fix error gin support min Go version (#2584)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-01-12 08:32:04 +08:00
Vas N
5e40c1d49c
DebugPrintRouteFunc() unit test (#2395)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2020-05-25 21:47:06 +08:00
thinkerou
2ee0e96394 Drop support go1.10 (#2147) 2019-11-24 23:07:56 +08:00
Dan Markham
fc920dc561 Drop Support for go1.8 and go1.9 (#1933) 2019-06-28 23:43:07 +08:00
Uwe Dauernheim
04eecb1283 Use DefaultWriter and DefaultErrorWriter for debug messages (#1891)
Aligns behaviour according to documentation.
2019-05-10 14:03:25 +08:00
Dan Markham
094f9a9105 v1.4.0 + #1631 (remove go1.6/go1,7 support) (#1851)
* remove go1.6 support

* remove build tag

* remove todo

* remove go1.6 support: https://github.com/gin-gonic/gin/pull/1383/commits

* update readme

* remove go1.7 support

* fix embedmd error

* test

* revert it

* revert it

* remove context_17

* add pusher test

* v1.4.0 rc1
2019-05-07 18:32:32 +08:00
Dmitry Kutakov
31bbb10f34 Make silent debug info on tests (#1765)
* make silent log on tests

* fix coverage: check end-of-line at the end of debug msg
2019-02-18 10:10:45 +08:00
Dmitry Kutakov
b056a34bdc fix errcheck warnings (#1739) 2019-01-18 09:32:53 +08:00
田欧
b7314d943c chore: fix debug test error (#1574) 2018-09-27 09:42:41 +08:00
田欧
834a2ec64c
feat: add go version judge when print debug warning log (#1572)
* feat: add go version judge when print debug warning log

* remove invalid statement

* use one const
2018-09-26 13:49:11 +08:00
Bo-Yi Wu
07f1bf0e63
feat: replace debug log with fmt package. (#1560) 2018-09-19 13:57:00 +08:00
田欧
6159213462 unify test data (#1417)
mkdir a test data dir.
2018-08-12 23:38:31 +08:00
田欧
c00f21ff23 add go version prerequisite and debug warning (#1394)
* add go version prerequisite and debug warning

* merge duplicate content

* remove duplicate content
2018-06-26 18:56:43 +08:00
田欧
0cb7c44abc Print warning log when user create one engine using gin.Default in debug mode (#1121)
* empty string check

* add log when use Default

* fix unit test error

* fix unit test error
2017-09-29 11:58:57 +08:00
Eason Lin
81007d2ce0 refactor(test): unify assert.Equal usage (#1054) 2017-08-04 13:45:59 +08:00
Eason Lin
735748b359 fix(tests): TestDebugPrintLoadTemplate use assert.Regep instead of assert.Equal (#973) 2017-07-04 03:36:12 -05:00
Javier Provecho Fernandez
a8ea89ea38 fix(test): remove wildcard loadtemplate 2017-07-02 11:17:42 +02:00
Eason Lin
76a63b257d Improve debug code coverage (#963)
* Improve debug.go code coverage

* lint code
2017-07-02 02:29:29 -05:00
Manu Mtz.-Almeida
8949247b92 Merge branch 'master' into develop
# Conflicts:
#	debug_test.go
2016-01-27 03:40:52 +01:00
Olivier Mengué
90911f53f2 debug: fix indent of routes dump for DELETE method
'DELETE' is 6 chars and breaks indent of the routes dump (only 5 chars
were reserved for the HTTP method).
2015-12-10 15:15:17 +01:00
Philipp Meinen
9fd8aff56e tests: make path assertions aware of vendoring
The path of a package can change in a situation where
dependency vendoring is in use.
This change modifies gin's unit tests to allow such paths.
2015-08-23 00:13:41 +02:00
Manu Mtz-Almeida
fd5d4294a5 debugPrintRoutes() unit test 2015-07-12 16:35:15 +02:00
Manu Mtz-Almeida
e2adae9003 Solution for Google App Engine?
https://cloud.google.com/appengine/docs/go/logs/
2015-05-24 01:00:17 +02:00
Manu Mtz-Almeida
b690611c38 Better debug logging + unit tests 2015-05-09 03:34:43 +02:00
Manu Mtz-Almeida
eb3e9293ed Renames []HandleFunc to HandlersChain 2015-05-07 11:30:01 +02:00
Manu Mtz-Almeida
0a192fb0fa Tons of unit tests 2015-04-09 12:15:02 +02:00
Manu Mtz-Almeida
54b3decc21 More unit tests 2015-04-08 13:30:17 +02:00
Manu Mtz-Almeida
ac0ad2fed8 Improves unit tests 2015-04-08 02:58:35 +02:00