Skip to content

Conversation

suwakei
Copy link
Contributor

@suwakei suwakei commented Jul 16, 2025

Fix mismatch between Go version check logic and warning message

Problem

There is a mismatch between the Go version check logic and the warning message shown to users:

  • Constant: const ginSupportMinGoVer = 21
  • Message: "[WARNING] Now Gin requires Go 1.23+\n"

As a result, users running Go 1.21 or 1.22 cannot see the warning, even though the message states that 1.23+ is required.

Cause

The logic in debugPrintWARNINGDefault():

func debugPrintWARNINGDefault() {
	if v, e := getMinVer(runtime.Version()); e == nil && v < ginSupportMinGoVer {
		debugPrint(`[WARNING] Now Gin requires Go 1.23+.

`)

With ginSupportMinGoVer = 21, however, users on Go 1.21 (v = 21) or 1.22 (v = 22) don't trigger the warning (v < 21 is false).

Fix

Update the constant ginSupportMinGoVer to 23 to match the warning message indicating that Go 1.23+ is required.

This ensures users running Go versions below 1.23 will properly receive the warning,
aligning behavior with messaging.

Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.92%. Comparing base (3dc1cd6) to head (514bdcd).
Report is 143 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4299      +/-   ##
==========================================
- Coverage   99.21%   98.92%   -0.30%     
==========================================
  Files          42       44       +2     
  Lines        3182     3437     +255     
==========================================
+ Hits         3157     3400     +243     
- Misses         17       26       +9     
- Partials        8       11       +3     
Flag Coverage Δ
?
--ldflags="-checklinkname=0" -tags sonic 98.85% <ø> (?)
-tags go_json 98.85% <ø> (?)
-tags nomsgpack 98.90% <ø> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 ?
go-1.23 98.92% <ø> (?)
go-1.24 98.92% <ø> (?)
macos-latest 98.92% <ø> (-0.30%) ⬇️
ubuntu-latest 98.92% <ø> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suwakei
Copy link
Contributor Author

suwakei commented Jul 16, 2025

We have verified that this change has written tests for all modified code.

The Codecov report also shows that all modified lines are covered.

The -0.30% decrease in overall coverage is likely due to the fact that the base branch is 142 commits older than master and does not affect this fix.

We appreciate your confirmation.

@appleboy appleboy added this to the v1.11 milestone Jul 17, 2025
@appleboy appleboy merged commit 5826722 into gin-gonic:master Jul 17, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants