Preparing release Gin v1.0rc1

This commit is contained in:
Manu Mtz-Almeida 2015-05-22 16:55:16 +02:00
parent 8549810e2e
commit 66fa43f9ae
4 changed files with 15 additions and 7 deletions

View File

@ -1,13 +1,15 @@
#Changelog #Changelog
###Gin 1.0 (...) ###Gin 1.0rc1 (May 22, 2015)
- [PERFORMANCE] Zero allocation router - [PERFORMANCE] Zero allocation router
- [PERFORMANCE] Faster JSON, XML and text rendering - [PERFORMANCE] Faster JSON, XML and text rendering
- [PERFORMANCE] Custom hand optimized HttpRouter for Gin - [PERFORMANCE] Custom hand optimized HttpRouter for Gin
- [PERFORMANCE] Misc code optimizations. Inlining, tail call optimizations - [PERFORMANCE] Misc code optimizations. Inlining, tail call optimizations
- [NEW] Built-in support for golang.org/x/net/context
- [NEW] Any(path, handler). Create a route that matches any path - [NEW] Any(path, handler). Create a route that matches any path
- [NEW] Refactored rendering pipeline (faster and static typeded) - [NEW] Refactored rendering pipeline (faster and static typeded)
- [NEW] Refactored errors API
- [NEW] IndentedJSON() prints pretty JSON - [NEW] IndentedJSON() prints pretty JSON
- [NEW] Added gin.DefaultWriter - [NEW] Added gin.DefaultWriter
- [NEW] UNIX socket support - [NEW] UNIX socket support
@ -15,6 +17,8 @@
- [NEW] JSON validation using go-validate-yourself (very powerful options) - [NEW] JSON validation using go-validate-yourself (very powerful options)
- [NEW] Completed suite of unit tests - [NEW] Completed suite of unit tests
- [NEW] HTTP streaming with c.Stream() - [NEW] HTTP streaming with c.Stream()
- [NEW] StaticFile() creates a router for serving just one file.
- [NEW] StaticFS() has an option to disable directory listing.
- [NEW] StaticFS() for serving static files through virtual filesystems - [NEW] StaticFS() for serving static files through virtual filesystems
- [NEW] Server-Sent Events native support - [NEW] Server-Sent Events native support
- [NEW] WrapF() and WrapH() helpers for wrapping http.HandlerFunc and http.Handler - [NEW] WrapF() and WrapH() helpers for wrapping http.HandlerFunc and http.Handler
@ -28,6 +32,7 @@
- [FIX] Redirect using built-in http.Redirect() - [FIX] Redirect using built-in http.Redirect()
- [FIX] Logger when printing the requested path - [FIX] Logger when printing the requested path
- [FIX] Documentation typos - [FIX] Documentation typos
- [FIX] Context.Engine renamed to Context.engine
- [FIX] Better debugging messages - [FIX] Better debugging messages
- [FIX] ErrorLogger - [FIX] ErrorLogger
- [FIX] Debug HTTP render - [FIX] Debug HTTP render

View File

@ -45,7 +45,7 @@ func main() {
Value string `json:"value" binding:"required"` Value string `json:"value" binding:"required"`
} }
if c.Bind(&json) { if c.Bind(&json) == nil {
DB[user] = json.Value DB[user] = json.Value
c.JSON(200, gin.H{"status": "ok"}) c.JSON(200, gin.H{"status": "ok"})
} }

2
gin.go
View File

@ -15,6 +15,8 @@ import (
"github.com/gin-gonic/gin/render" "github.com/gin-gonic/gin/render"
) )
const Version = "v1.0rc1"
var default404Body = []byte("404 page not found") var default404Body = []byte("404 page not found")
var default405Body = []byte("405 method not allowed") var default405Body = []byte("405 method not allowed")

11
mode.go
View File

@ -5,12 +5,13 @@
package gin package gin
import ( import (
"io"
"os" "os"
"github.com/mattn/go-colorable" "github.com/mattn/go-colorable"
) )
const GIN_MODE = "GIN_MODE" const ENV_GIN_MODE = "GIN_MODE"
const ( const (
DebugMode string = "debug" DebugMode string = "debug"
@ -23,16 +24,16 @@ const (
testCode = iota testCode = iota
) )
var DefaultWriter = colorable.NewColorableStdout() var DefaultWriter io.Writer = colorable.NewColorableStdout()
var ginMode int = debugCode var ginMode int = debugCode
var modeName string = DebugMode var modeName string = DebugMode
func init() { func init() {
value := os.Getenv(GIN_MODE) mode := os.Getenv(ENV_GIN_MODE)
if len(value) == 0 { if len(mode) == 0 {
SetMode(DebugMode) SetMode(DebugMode)
} else { } else {
SetMode(value) SetMode(mode)
} }
} }