Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make "" mode being the same as debug mode #1250

Merged
merged 1 commit into from
Feb 23, 2018

Conversation

mariokostelac
Copy link
Contributor

@mariokostelac mariokostelac commented Feb 11, 2018

Not setting mode explicitly sets gin into debug mode, but it does not
make it possible to retrieve gin mode as Debug since it's set to "".
Calling gin.Mode() returns "" even though gin is in debug mode.

The alternative approach is to change SetMode to not accept "" and make init function calling SetMode(DebugMode) explicitly when the mode is not defined. That would definitely change how SetMode reacts to inputs and could break some apps.

@codecov
Copy link

codecov bot commented Feb 11, 2018

Codecov Report

Merging #1250 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1250      +/-   ##
=========================================
+ Coverage    98.4%   98.4%   +<.01%     
=========================================
  Files          34      34              
  Lines        1757    1759       +2     
=========================================
+ Hits         1729    1731       +2     
  Misses         23      23              
  Partials        5       5
Impacted Files Coverage Δ
mode.go 90.9% <100%> (+0.9%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbb1ee8...3dae84f. Read the comment docs.

mode.go Outdated
case "":
ginMode = debugCode
value = DebugMode
case DebugMode:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this part and add the following code.

find

modeName = value

add before

if value == "" {
    value = DebugMode
}
modeName = value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Not setting mode explicitly sets gin into debug mode, but it does not
make it possible to retrieve gin mode as Debug since it's set to "".
@appleboy appleboy merged commit 5d3f30c into gin-gonic:master Feb 23, 2018
tonyhhyip pushed a commit to ysitd-cloud/gin that referenced this pull request Apr 28, 2018
Not setting mode explicitly sets gin into debug mode, but it does not
make it possible to retrieve gin mode as Debug since it's set to "".

(cherry picked from commit 5d3f30c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants