mirror of
				https://github.com/gin-gonic/gin.git
				synced 2025-11-04 01:02:14 +08:00 
			
		
		
		
	Adds TestMode
This commit is contained in:
		
							parent
							
								
									378610b3b2
								
							
						
					
					
						commit
						0ed259ca34
					
				
							
								
								
									
										4
									
								
								mode.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								mode.go
									
									
									
									
									
								
							@ -9,10 +9,12 @@ const GIN_MODE = "GIN_MODE"
 | 
				
			|||||||
const (
 | 
					const (
 | 
				
			||||||
	DebugMode   string = "debug"
 | 
						DebugMode   string = "debug"
 | 
				
			||||||
	ReleaseMode string = "release"
 | 
						ReleaseMode string = "release"
 | 
				
			||||||
 | 
						TestMode    string = "test"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
	debugCode   = iota
 | 
						debugCode   = iota
 | 
				
			||||||
	releaseCode = iota
 | 
						releaseCode = iota
 | 
				
			||||||
 | 
						testCode    = iota
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var gin_mode int = debugCode
 | 
					var gin_mode int = debugCode
 | 
				
			||||||
@ -23,6 +25,8 @@ func SetMode(value string) {
 | 
				
			|||||||
		gin_mode = debugCode
 | 
							gin_mode = debugCode
 | 
				
			||||||
	case ReleaseMode:
 | 
						case ReleaseMode:
 | 
				
			||||||
		gin_mode = releaseCode
 | 
							gin_mode = releaseCode
 | 
				
			||||||
 | 
						case TestMode:
 | 
				
			||||||
 | 
							gin_mode = testCode
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		panic("gin mode unknown, the allowed modes are: " + DebugMode + " and " + ReleaseMode)
 | 
							panic("gin mode unknown, the allowed modes are: " + DebugMode + " and " + ReleaseMode)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user