diff --git a/client/client_test.go b/client/client_test.go index 2e9648e..dfcf5e8 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -1,7 +1,6 @@ package client import ( - "encoding/json" "net" "strconv" "sync" diff --git a/client/httptransport.go b/client/httptransport.go index aab070d..f559245 100644 --- a/client/httptransport.go +++ b/client/httptransport.go @@ -2,7 +2,6 @@ package client import ( "bytes" - "encoding/json" "errors" "io/ioutil" "net/http" diff --git a/client/sockettransport.go b/client/sockettransport.go index 96bb09f..0a7959f 100644 --- a/client/sockettransport.go +++ b/client/sockettransport.go @@ -1,7 +1,6 @@ package client import ( - "encoding/json" "errors" "fmt" "io" @@ -11,8 +10,11 @@ import ( "github.com/foomo/contentserver/responses" "github.com/foomo/contentserver/server" + jsoniter "github.com/json-iterator/go" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + type serverResponse struct { Reply interface{} } diff --git a/repo/loader.go b/repo/loader.go index d562f44..0aa522a 100644 --- a/repo/loader.go +++ b/repo/loader.go @@ -1,7 +1,6 @@ package repo import ( - "encoding/json" "errors" "fmt" "io/ioutil" @@ -10,8 +9,11 @@ import ( "github.com/foomo/contentserver/content" "github.com/foomo/contentserver/log" + jsoniter "github.com/json-iterator/go" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + func (repo *Repo) updateRoutine() { go func() { for newDimension := range repo.updateChannel { diff --git a/server/handlerequest.go b/server/handlerequest.go index 980bcbb..92fdfec 100644 --- a/server/handlerequest.go +++ b/server/handlerequest.go @@ -1,7 +1,6 @@ package server import ( - "encoding/json" "fmt" "time" @@ -10,9 +9,12 @@ import ( "github.com/foomo/contentserver/requests" "github.com/foomo/contentserver/responses" "github.com/foomo/contentserver/status" + jsoniter "github.com/json-iterator/go" "github.com/prometheus/client_golang/prometheus" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + func handleRequest(r *repo.Repo, handler Handler, jsonBytes []byte, metrics *status.Metrics) (replyBytes []byte, err error) { var ( diff --git a/status/healthz.go b/status/healthz.go index d91c712..dba2936 100644 --- a/status/healthz.go +++ b/status/healthz.go @@ -1,13 +1,15 @@ package status import ( - "encoding/json" "fmt" "net/http" "github.com/foomo/contentserver/log" + jsoniter "github.com/json-iterator/go" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + func RunHealthzHandlerListener(address string, serviceName string) { log.Notice(fmt.Sprintf("starting healthz handler on '%s'" + address)) log.Error(http.ListenAndServe(address, HealthzHandler(serviceName)))