Skip to content

Commit

Permalink
Merge branch 'master' into fix/issue#2682
Browse files Browse the repository at this point in the history
  • Loading branch information
g1eny0ung authored May 10, 2021
2 parents 47b1ea4 + 4fe5f3e commit 808f903
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Gin is a web framework written in Go (Golang). It features a martini-like API wi
- [Benchmarks](#benchmarks)
- [Gin v1. stable](#gin-v1-stable)
- [Build with jsoniter/go-json](#build-with-json-replacement)
- [Build without `MsgPack` rendering feature](#build-without-msgpack-rendering-feature)
- [API Examples](#api-examples)
- [Using GET, POST, PUT, PATCH, DELETE and OPTIONS](#using-get-post-put-patch-delete-and-options)
- [Parameters in path](#parameters-in-path)
Expand Down Expand Up @@ -195,6 +196,16 @@ $ go build -tags=jsoniter .
$ go build -tags=go_json .
```

## Build without `MsgPack` rendering feature

Gin enables `MsgPack` rendering feature by default. But you can disable this feature by specifying `nomsgpack` build tag.

```sh
$ go build -tags=nomsgpack .
```

This is useful to reduce the binary size of executable files. See the [detail information](https://github.com/gin-gonic/gin/pull/1852).

## API Examples

You can find a number of ready-to-run examples at [Gin examples repository](https://github.com/gin-gonic/examples).
Expand Down Expand Up @@ -930,7 +941,7 @@ func main() {
route.GET("/:name/:id", func(c *gin.Context) {
var person Person
if err := c.ShouldBindUri(&person); err != nil {
c.JSON(400, gin.H{"msg": err})
c.JSON(400, gin.H{"msg": err.Error()})
return
}
c.JSON(200, gin.H{"name": person.Name, "uuid": person.ID})
Expand Down
3 changes: 1 addition & 2 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ var defaultLogFormatter = func(param LogFormatterParams) string {
}

if param.Latency > time.Minute {
// Truncate in a golang < 1.8 safe way
param.Latency = param.Latency - param.Latency%time.Second
param.Latency = param.Latency.Truncate(time.Second)
}
return fmt.Sprintf("[GIN] %v |%s %3d %s| %13v | %15s |%s %-7s %s %#v\n%s",
param.TimeStamp.Format("2006/01/02 - 15:04:05"),
Expand Down

0 comments on commit 808f903

Please sign in to comment.