refactor(json): make jsonite optional with build tags (#1026)
* refactor(json): Restore gin support for app engine Create new folder to support multiple json package. restore gin support for app engine (disable jsonite through tags) use jsoniter $ go build -tags=jsoniter . use default json $ go build . Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * rename json file. Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * docs(json): add build tags document. * fix(docs): markdown format. * fix(json): missing space.
This commit is contained in:
committed by
Javier Provecho Fernandez
parent
7180f2ba62
commit
ce670a6497
17
json/json.go
Normal file
17
json/json.go
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2017 Bo-Yi Wu. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !jsoniter
|
||||
|
||||
package json
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
var (
|
||||
Marshal = json.Marshal
|
||||
MarshalIndent = json.MarshalIndent
|
||||
NewDecoder = json.NewDecoder
|
||||
)
|
18
json/jsoniter.go
Normal file
18
json/jsoniter.go
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2017 Bo-Yi Wu. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build jsoniter
|
||||
|
||||
package json
|
||||
|
||||
import (
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
var (
|
||||
json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
Marshal = json.Marshal
|
||||
MarshalIndent = json.MarshalIndent
|
||||
NewDecoder = json.NewDecoder
|
||||
)
|
Reference in New Issue
Block a user