Skip to content

Commit

Permalink
Remove json-iterator from the project (#4681)
Browse files Browse the repository at this point in the history
Recently we found that json-iterator can panic due to incorrect use of
package unsafe. Since json performance is less of a concern than it used
to be, and since encoding/json has progressed in its performance since,
then, I believe it's wise to remove it from the project altogether.

I've also created new tags for core/v2, corev/3, and types modules, and
have updated the go.mods in the repository to reflect that.

Signed-off-by: Eric Chlebek <[email protected]>
  • Loading branch information
echlebek authored Apr 4, 2022
1 parent 5ee76f3 commit ae94b91
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 66 deletions.
4 changes: 2 additions & 2 deletions api/core/v2/check.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package v2

import (
"encoding/json"
"errors"
"fmt"
"net/url"
"path"
"time"

jsoniter "github.com/json-iterator/go"
cron "github.com/robfig/cron/v3"
utilstrings "github.com/sensu/sensu-go/api/core/v2/internal/stringutil"
)
Expand Down Expand Up @@ -268,7 +268,7 @@ func (c *Check) MarshalJSON() ([]byte, error) {
clone := &Clone{}
*clone = Clone(*c)

return jsoniter.Marshal(clone)
return json.Marshal(clone)
}

// MergeWith updates the current Check with the history of the check given as
Expand Down
4 changes: 2 additions & 2 deletions api/core/v2/check_config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package v2

import (
"encoding/json"
"errors"
fmt "fmt"
"net/url"
Expand All @@ -10,7 +11,6 @@ import (
"strings"
"time"

jsoniter "github.com/json-iterator/go"
cron "github.com/robfig/cron/v3"
stringsutil "github.com/sensu/sensu-go/api/core/v2/internal/stringutil"
)
Expand Down Expand Up @@ -71,7 +71,7 @@ func (c *CheckConfig) MarshalJSON() ([]byte, error) {
clone := &Clone{}
*clone = Clone(*c)

return jsoniter.Marshal(clone)
return json.Marshal(clone)
}

// SetNamespace sets the namespace of the resource.
Expand Down
4 changes: 2 additions & 2 deletions api/core/v2/entity.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package v2

import (
"encoding/json"
"errors"
"fmt"
"net/url"
"path"
"strconv"
"strings"

jsoniter "github.com/json-iterator/go"
"github.com/sensu/sensu-go/api/core/v2/internal/stringutil"
)

Expand Down Expand Up @@ -112,7 +112,7 @@ func (e *Entity) MarshalJSON() ([]byte, error) {
type Clone Entity
clone := (*Clone)(e)

return jsoniter.Marshal(clone)
return json.Marshal(clone)
}

// GetEntitySubscription returns the entity subscription, using the format
Expand Down
9 changes: 4 additions & 5 deletions api/core/v2/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"time"

"github.com/google/uuid"
jsoniter "github.com/json-iterator/go"
stringsutil "github.com/sensu/sensu-go/api/core/v2/internal/stringutil"
)

Expand Down Expand Up @@ -412,7 +411,7 @@ func (e *Event) LogFields(debug bool) map[string]interface{} {

func (e Event) MarshalJSON() ([]byte, error) {
type clone Event
b, err := jsoniter.Marshal((*clone)(&e))
b, err := json.Marshal((*clone)(&e))
if err != nil {
return nil, err
}
Expand All @@ -426,10 +425,10 @@ func (e Event) MarshalJSON() ([]byte, error) {
if err != nil {
return nil, fmt.Errorf("invalid event ID: %s", err)
}
idBytes, _ := jsoniter.Marshal(uid.String())
idBytes, _ := json.Marshal(uid.String())
msg["id"] = (*json.RawMessage)(&idBytes)
}
return jsoniter.Marshal(msg)
return json.Marshal(msg)
}

func (e *Event) UnmarshalJSON(b []byte) error {
Expand All @@ -447,7 +446,7 @@ func (e *Event) UnmarshalJSON(b []byte) error {
}
if len(id) > 0 {
delete(msg, "id")
b, _ = jsoniter.Marshal(msg)
b, _ = json.Marshal(msg)
}
if err := json.Unmarshal(b, (*clone)(e)); err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion api/core/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/golang-jwt/jwt/v4 v4.0.0
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.1.2
github.com/json-iterator/go v1.1.9
github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff
github.com/robfig/cron/v3 v3.0.1
github.com/sirupsen/logrus v1.6.0
Expand Down
10 changes: 0 additions & 10 deletions api/core/v2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,13 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand All @@ -75,7 +66,6 @@ github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgho=
github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand Down
6 changes: 3 additions & 3 deletions api/core/v2/hook.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package v2

import (
"encoding/json"
"errors"
fmt "fmt"
"net/url"
"path"
"regexp"
"time"

jsoniter "github.com/json-iterator/go"
stringsutil "github.com/sensu/sensu-go/api/core/v2/internal/stringutil"
)

Expand Down Expand Up @@ -109,13 +109,13 @@ func isSeverity(name string) bool {
// MarshalJSON implements the json.Marshaler interface.
func (h *HookList) MarshalJSON() ([]byte, error) {
result := map[string][]string{h.Type: h.Hooks}
return jsoniter.Marshal(result)
return json.Marshal(result)
}

// UnmarshalJSON implements the json.Marshaler interface.
func (h *HookList) UnmarshalJSON(b []byte) error {
result := map[string][]string{}
if err := jsoniter.Unmarshal(b, &result); err != nil {
if err := json.Unmarshal(b, &result); err != nil {
return err
}
for k, v := range result {
Expand Down
3 changes: 1 addition & 2 deletions api/core/v2/internal/types/dynamic/dynamic_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"testing"

jsoniter "github.com/json-iterator/go"
corev2 "github.com/sensu/sensu-go/api/core/v2"
"github.com/sensu/sensu-go/api/core/v2/internal/types/dynamic"
)
Expand All @@ -21,6 +20,6 @@ func BenchmarkCheckMarshalRoundtrip(b *testing.B) {
bytez, _ := json.Marshal(c)
for i := 0; i < b.N; i++ {
var check corev2.Check
_ = jsoniter.Unmarshal(bytez, &check)
_ = json.Unmarshal(bytez, &check)
}
}
5 changes: 2 additions & 3 deletions api/core/v3/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ replace (

require (
github.com/gogo/protobuf v1.3.2
github.com/golang-jwt/jwt/v4 v4.0.0 // indirect
github.com/golang/protobuf v1.5.2
github.com/sensu/sensu-go/api/core/v2 v2.6.0
github.com/sensu/sensu-go/types v0.3.0
github.com/sensu/sensu-go/api/core/v2 v2.9.1-alpha
github.com/sensu/sensu-go/types v0.9.1-alpha
)
9 changes: 0 additions & 9 deletions api/core/v3/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/echlebek/crock v1.0.1 h1:KbzamClMIfVIkkjq/GTXf+N16KylYBpiaTitO3f1ujg=
github.com/echlebek/crock v1.0.1/go.mod h1:/kvwHRX3ZXHj/kHWJkjXDmzzRow54EJuHtQ/PapL/HI=
github.com/echlebek/timeproxy v1.0.0 h1:V41/v8tmmMDNMA2GrBPI45nlXb3F7+OY+nJz1BqKsCk=
Expand Down Expand Up @@ -51,21 +50,14 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand All @@ -79,7 +71,6 @@ github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgho=
github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand Down
4 changes: 2 additions & 2 deletions backend/eventd/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package eventd

import (
"bytes"
"encoding/json"
"fmt"
"io"
"runtime"
"sync"
"syscall"
"time"

jsoniter "github.com/json-iterator/go"
"github.com/sensu/sensu-go/backend/logging"
"github.com/sensu/sensu-go/backend/messaging"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -182,7 +182,7 @@ func (l *rawLogger) encoder() {
defer close(l.output)

var buf bytes.Buffer
encoder := jsoniter.NewEncoder(&buf)
encoder := json.NewEncoder(&buf)

for input := range l.encoderInput {
buf.Reset()
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ require (
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097
github.com/ipfs/go-log v1.0.4 // indirect
github.com/jbenet/go-reuseport v0.0.0-20180416043609-15a1cd37f050 // indirect
github.com/json-iterator/go v1.1.12
github.com/json-iterator/go v1.1.12 // indirect
github.com/libp2p/go-reuseport v0.0.0-20180416043609-15a1cd37f050 // indirect
github.com/libp2p/go-sockaddr v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
Expand All @@ -57,9 +57,9 @@ require (
github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff
github.com/robfig/cron/v3 v3.0.1
github.com/sensu/lasr v1.2.1
github.com/sensu/sensu-go/api/core/v2 v2.6.0
github.com/sensu/sensu-go/api/core/v3 v3.3.0
github.com/sensu/sensu-go/types v0.3.0
github.com/sensu/sensu-go/api/core/v2 v2.9.1-alpha
github.com/sensu/sensu-go/api/core/v3 v3.6.1-alpha
github.com/sensu/sensu-go/types v0.9.1-alpha
github.com/shirou/gopsutil/v3 v3.21.12
github.com/sirupsen/logrus v1.7.0
github.com/spf13/cobra v1.1.3
Expand All @@ -75,6 +75,7 @@ require (
go.etcd.io/etcd/client/v3 v3.5.0
go.etcd.io/etcd/server/v3 v3.5.0
go.etcd.io/etcd/tests/v3 v3.5.0
go.uber.org/atomic v1.7.0
go.uber.org/zap v1.17.0
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9q
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down
9 changes: 0 additions & 9 deletions licenses/bom.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,6 @@
}
]
},
{
"project": "github.com/json-iterator/go",
"licenses": [
{
"type": "MIT License",
"confidence": 1
}
]
},
{
"project": "github.com/libp2p/go-reuseport",
"licenses": [
Expand Down
3 changes: 1 addition & 2 deletions types/dynamic/dynamic_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"testing"

jsoniter "github.com/json-iterator/go"
"github.com/sensu/sensu-go/types"
"github.com/sensu/sensu-go/types/dynamic"
)
Expand All @@ -21,6 +20,6 @@ func BenchmarkCheckMarshalRoundtrip(b *testing.B) {
bytez, _ := json.Marshal(c)
for i := 0; i < b.N; i++ {
var check types.Check
_ = jsoniter.Unmarshal(bytez, &check)
_ = json.Unmarshal(bytez, &check)
}
}
7 changes: 3 additions & 4 deletions types/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ replace (
)

require (
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/json-iterator/go v1.1.9
github.com/blang/semver/v4 v4.0.0
github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff
github.com/sensu/sensu-go/api/core/v2 v2.6.0
github.com/sensu/sensu-go/api/core/v3 v3.3.0
github.com/sensu/sensu-go/api/core/v2 v2.9.1-alpha
github.com/sensu/sensu-go/api/core/v3 v3.6.1-alpha
github.com/stretchr/testify v1.6.0
)
4 changes: 0 additions & 4 deletions types/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,12 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down

0 comments on commit ae94b91

Please sign in to comment.