MCPcopy
hub / github.com/gin-gonic/gin / SetMode

Function SetMode

mode.go:58–78  ·  view source on GitHub ↗

SetMode sets gin mode according to input string.

(value string)

Source from the content-addressed store, hash-verified

56
57// SetMode sets gin mode according to input string.
58func SetMode(value string) {
59 if value == "" {
60 if flag.Lookup("test.v") != nil {
61 value = TestMode
62 } else {
63 value = DebugMode
64 }
65 }
66
67 switch value {
68 case DebugMode:
69 atomic.StoreInt32(&ginMode, debugCode)
70 case ReleaseMode:
71 atomic.StoreInt32(&ginMode, releaseCode)
72 case TestMode:
73 atomic.StoreInt32(&ginMode, testCode)
74 default:
75 panic("gin mode unknown: " + value + " (available mode: debug release test)")
76 }
77 modeName.Store(value)
78}
79
80// DisableBindValidation closes the default validator.
81func DisableBindValidation() {

Callers 15

initFunction · 0.92
TestPanicInHandlerFunction · 0.85
TestCustomRecoveryFunction · 0.85
TestContextRenderHTML2Function · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85
TestIsDebuggingFunction · 0.85

Calls

no outgoing calls

Tested by 15

initFunction · 0.74
TestPanicInHandlerFunction · 0.68
TestCustomRecoveryFunction · 0.68
TestContextRenderHTML2Function · 0.68
initFunction · 0.68
initFunction · 0.68
initFunction · 0.68
initFunction · 0.68
TestIsDebuggingFunction · 0.68
TestDebugPrintFunction · 0.68