Skip to content

Commit

Permalink
Revert "refactor(json): make jsonite optional with build tags (gin-go…
Browse files Browse the repository at this point in the history
…nic#1026)"

This reverts commit ce670a6.
  • Loading branch information
SegFaultx64 committed Jul 18, 2017
1 parent 89bebbb commit 8286705
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 47 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ BenchmarkZeus_GithubAll | 2000 | 944234 | 300688 | 2648
- [x] Battle tested
- [x] API frozen, new releases will not break your code.


## Start using it

1. Download and install it:
Expand Down Expand Up @@ -140,14 +141,6 @@ $ curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/mai
$ go run main.go
```

## Build with [jsoniter](https://github.com/json-iterator/go)

Gin use `encoding/json` as default json package but you can change to [jsoniter](https://github.com/json-iterator/go) by build from other tags.

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

## API Examples

### Using GET, POST, PUT, PATCH, DELETE and OPTIONS
Expand Down
3 changes: 2 additions & 1 deletion binding/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ package binding
import (
"net/http"

"github.com/gin-gonic/gin/json"
"github.com/json-iterator/go"
)

var (
json = jsoniter.ConfigCompatibleWithStandardLibrary
EnableDecoderUseNumber = false
)

Expand Down
4 changes: 3 additions & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import (
"fmt"
"reflect"

"github.com/gin-gonic/gin/json"
"github.com/json-iterator/go"
)

var json = jsoniter.ConfigCompatibleWithStandardLibrary

type ErrorType uint64

const (
Expand Down
1 change: 0 additions & 1 deletion errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"testing"

"github.com/gin-gonic/gin/json"
"github.com/stretchr/testify/assert"
)

Expand Down
17 changes: 0 additions & 17 deletions json/json.go

This file was deleted.

18 changes: 0 additions & 18 deletions json/jsoniter.go

This file was deleted.

4 changes: 3 additions & 1 deletion render/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import (
"bytes"
"net/http"

"github.com/gin-gonic/gin/json"
"github.com/json-iterator/go"
)

var json = jsoniter.ConfigCompatibleWithStandardLibrary

type JSON struct {
Data interface{}
}
Expand Down

0 comments on commit 8286705

Please sign in to comment.