瀏覽代碼

Preparing release Gin v1.0rc1

Manu Mtz-Almeida 10 年之前
父節點
當前提交
66fa43f9ae
共有 4 個文件被更改,包括 15 次插入7 次删除
  1. 6 1
      CHANGELOG.md
  2. 1 1
      examples/basic/main.go
  3. 2 0
      gin.go
  4. 6 5
      mode.go

+ 6 - 1
CHANGELOG.md

@@ -1,13 +1,15 @@
 #Changelog
 
-###Gin 1.0 (...)
+###Gin 1.0rc1 (May 22, 2015)
 
 - [PERFORMANCE] Zero allocation router
 - [PERFORMANCE] Faster JSON, XML and text rendering
 - [PERFORMANCE] Custom hand optimized HttpRouter for Gin
 - [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] Refactored rendering pipeline (faster and static typeded)
+- [NEW] Refactored errors API
 - [NEW] IndentedJSON() prints pretty JSON
 - [NEW] Added gin.DefaultWriter
 - [NEW] UNIX socket support
@@ -15,6 +17,8 @@
 - [NEW] JSON validation using go-validate-yourself (very powerful options)
 - [NEW] Completed suite of unit tests
 - [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] Server-Sent Events native support
 - [NEW] WrapF() and WrapH() helpers for wrapping http.HandlerFunc and http.Handler
@@ -28,6 +32,7 @@
 - [FIX] Redirect using built-in http.Redirect()
 - [FIX] Logger when printing the requested path
 - [FIX] Documentation typos
+- [FIX] Context.Engine renamed to Context.engine
 - [FIX] Better debugging messages
 - [FIX] ErrorLogger
 - [FIX] Debug HTTP render

+ 1 - 1
examples/example_basic.go → examples/basic/main.go

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

+ 2 - 0
gin.go

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

+ 6 - 5
mode.go

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