From 6fbfcacfa07fdaa6bcdc72e90f589b9274657ebe Mon Sep 17 00:00:00 2001 From: Austin Heap Date: Thu, 3 Jul 2014 08:23:03 -0700 Subject: [PATCH 1/5] base travis ci config --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..825dc3f2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: go + +go: + - 1.0 + - 1.1 + - 1.2 + - 1.3 + - tip From 9d4f958ce4c95739bb659c1cc3dc171c542a140d Mon Sep 17 00:00:00 2001 From: Austin Heap Date: Thu, 3 Jul 2014 08:29:44 -0700 Subject: [PATCH 2/5] including build status in readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c2a5f117..d9249897 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ #Gin Web Framework [![GoDoc](https://godoc.org/github.com/gin-gonic/gin?status.png)](https://godoc.org/github.com/gin-gonic/gin) +[![Build Status](https://travis-ci.org/gin-gonic/gin.svg)](https://travis-ci.org/gin-gonic/gin) Gin is a web framework written in Golang. It features a martini-like API with much better performance, up to 40 times faster. If you need performance and good productivity, you will love Gin. [Check out the official web site](http://gin-gonic.github.io/gin/) From 48911116ce032f5b7ff61f6e5eba9990777acedf Mon Sep 17 00:00:00 2001 From: Austin Heap Date: Thu, 3 Jul 2014 08:30:00 -0700 Subject: [PATCH 3/5] removing CI for go v1.0 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 825dc3f2..57bd4a76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: go go: - - 1.0 - 1.1 - 1.2 - 1.3 From 8e7b8174602836e098f4290a6bc9bf501f6f853a Mon Sep 17 00:00:00 2001 From: Alexander Nyquist Date: Thu, 3 Jul 2014 17:32:47 +0200 Subject: [PATCH 4/5] Using template.Must to fix multiple return issue. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c2a5f117..041b49c5 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,7 @@ You can also use your own html template render import "html/template" func main() { r := gin.Default() - html := template.ParseFiles("file1", "file2") + html := template.Must(template.ParseFiles("file1", "file2")) r.HTMLTemplates = html // Listen and server on 0.0.0.0:8080 From fd30d289a9dc137b9f5af57823ac05593f60fa94 Mon Sep 17 00:00:00 2001 From: jasonrhansen Date: Thu, 3 Jul 2014 12:30:01 -0600 Subject: [PATCH 5/5] Fix spelling and grammar errors in comments --- gin.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/gin.go b/gin.go index 847df19c..197b98ca 100644 --- a/gin.go +++ b/gin.go @@ -23,7 +23,7 @@ type ( H map[string]interface{} - // Used internally to collect a error ocurred during a http request. + // Used internally to collect errors that occurred during an http request. ErrorMsg struct { Err string `json:"error"` Meta interface{} `json:"meta"` @@ -53,7 +53,7 @@ type ( engine *Engine } - // Represents the web framework, it wrappers the blazing fast httprouter multiplexer and a list of global middlewares. + // Represents the web framework, it wraps the blazing fast httprouter multiplexer and a list of global middlewares. Engine struct { *RouterGroup handlers404 []HandlerFunc @@ -152,7 +152,7 @@ func (group *RouterGroup) Use(middlewares ...HandlerFunc) { group.Handlers = append(group.Handlers, middlewares...) } -// Greates a new router group. You should create add all the routes that share that have common middlwares or same path prefix. +// Creates a new router group. You should add all the routes that have common middlwares or the same path prefix. // For example, all the routes that use a common middlware for authorization could be grouped. func (group *RouterGroup) Group(component string, handlers ...HandlerFunc) *RouterGroup { prefix := path.Join(group.prefix, component) @@ -238,7 +238,7 @@ func (c *Context) Abort(code int) { c.index = AbortIndex } -// Fail is the same than Abort plus an error message. +// Fail is the same as Abort plus an error message. // Calling `context.Fail(500, err)` is equivalent to: // ``` // context.Error("Operation aborted", err) @@ -249,8 +249,8 @@ func (c *Context) Fail(code int, err error) { c.Abort(code) } -// Attachs an error to the current context. The error is pushed to a list of errors. -// It's a gooc idea to call Error for each error ocurred during the resolution of a request. +// Attaches an error to the current context. The error is pushed to a list of errors. +// It's a good idea to call Error for each error that occurred during the resolution of a request. // A middleware can be used to collect all the errors and push them to a database together, print a log, or append it in the HTTP response. func (c *Context) Error(err error, meta interface{}) { c.Errors = append(c.Errors, ErrorMsg{ @@ -272,8 +272,8 @@ func (c *Context) LastError() error { /******** METADATA MANAGEMENT********/ /************************************/ -// Sets a new pair key/value just for the specefied context. -// It also lazy initializes the hashmap +// Sets a new pair key/value just for the specified context. +// It also lazy initializes the hashmap. func (c *Context) Set(key string, item interface{}) { if c.Keys == nil { c.Keys = make(map[string]interface{}) @@ -320,8 +320,8 @@ func (c *Context) ParseBody(item interface{}) error { } } -// Serializes the given struct as a JSON into the response body in a fast and efficient way. -// It also sets the Content-Type as "application/json" +// Serializes the given struct as JSON into the response body in a fast and efficient way. +// It also sets the Content-Type as "application/json". func (c *Context) JSON(code int, obj interface{}) { c.Writer.Header().Set("Content-Type", "application/json") if code >= 0 { @@ -334,8 +334,8 @@ func (c *Context) JSON(code int, obj interface{}) { } } -// Serializes the given struct as a XML into the response body in a fast and efficient way. -// It also sets the Content-Type as "application/xml" +// Serializes the given struct as XML into the response body in a fast and efficient way. +// It also sets the Content-Type as "application/xml". func (c *Context) XML(code int, obj interface{}) { c.Writer.Header().Set("Content-Type", "application/xml") if code >= 0 { @@ -348,8 +348,8 @@ func (c *Context) XML(code int, obj interface{}) { } } -// Renders the HTTP template specified by his file name. -// It also update the HTTP code and sets the Content-Type as "text/html". +// Renders the HTTP template specified by its file name. +// It also updates the HTTP code and sets the Content-Type as "text/html". // See http://golang.org/doc/articles/wiki/ func (c *Context) HTML(code int, name string, data interface{}) { c.Writer.Header().Set("Content-Type", "text/html") @@ -365,7 +365,7 @@ func (c *Context) HTML(code int, name string, data interface{}) { } } -// Writes the given string into the response body and sets the Content-Type to "text/plain" +// Writes the given string into the response body and sets the Content-Type to "text/plain". func (c *Context) String(code int, msg string) { if code >= 0 { c.Writer.WriteHeader(code) @@ -374,7 +374,7 @@ func (c *Context) String(code int, msg string) { c.Writer.Write([]byte(msg)) } -// Writes some data into the body stream and updates the HTTP code +// Writes some data into the body stream and updates the HTTP code. func (c *Context) Data(code int, data []byte) { c.Writer.WriteHeader(code) c.Writer.Write(data)