diff --git a/go.mod b/go.mod index dedef23..e555b3d 100644 --- a/go.mod +++ b/go.mod @@ -6,15 +6,13 @@ toolchain go1.23.4 require ( github.com/fvbommel/sortorder v1.1.0 - github.com/json-iterator/go v1.1.12 + github.com/goccy/go-json v0.10.4 github.com/panotza/gosmc v1.0.0 github.com/spf13/cobra v1.8.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 3e866c6..15ada15 100644 --- a/go.sum +++ b/go.sum @@ -1,23 +1,16 @@ github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -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/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQmYw= github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= +github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jedib0t/go-pretty/v6 v6.6.4 h1:B51RjA+Sytv0C0Je7PHGDXZBF2JpS5dZEWWRueBLP6U= github.com/jedib0t/go-pretty/v6 v6.6.4/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/panotza/gosmc v1.0.0 h1:xlszb8fU00ixVI5W00nnvicK66e6fKrVzffznnwqVlw= github.com/panotza/gosmc v1.0.0/go.mod h1:LDwtbaiO0SB+duuYFnFx/AFulj42kVlXAhz1aQBk0tg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -30,8 +23,6 @@ github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= diff --git a/output/jsonoutput.go b/output/jsonoutput.go index 461371c..1be7d7e 100644 --- a/output/jsonoutput.go +++ b/output/jsonoutput.go @@ -23,7 +23,7 @@ import ( "strconv" "strings" - jsoniter "github.com/json-iterator/go" + "github.com/goccy/go-json" ) type JSONOutput struct { @@ -51,8 +51,6 @@ func format(d any) (any, error) { return v, fmt.Errorf("not a map") } - json := jsoniter.ConfigCompatibleWithStandardLibrary - for key, entry := range v { t, err := json.Marshal(entry) if err != nil { @@ -100,7 +98,6 @@ func (jo JSONOutput) All() { } } - json := jsoniter.ConfigCompatibleWithStandardLibrary out, _ := json.Marshal(data) fmt.Println(string(out)) } @@ -136,7 +133,6 @@ func (jo JSONOutput) print(v any) { return } - json := jsoniter.ConfigCompatibleWithStandardLibrary out, _ := json.Marshal(data) fmt.Println(string(out)) } diff --git a/output/output.go b/output/output.go index ebb9d08..d006ddf 100644 --- a/output/output.go +++ b/output/output.go @@ -19,7 +19,7 @@ package output import ( "github.com/dkorunic/iSMC/hid" "github.com/dkorunic/iSMC/smc" - jsoniter "github.com/json-iterator/go" + "github.com/goccy/go-json" ) // monkey patching for testing @@ -92,7 +92,6 @@ func getVoltage() map[string]any { // TODO replace with a variant from an utility package func deepCopy(dest, src map[string]any) { - json := jsoniter.ConfigCompatibleWithStandardLibrary jsonStr, _ := json.Marshal(src) _ = json.Unmarshal(jsonStr, &dest) } diff --git a/output/output_test.go b/output/output_test.go index 34ec0df..9c9aae9 100644 --- a/output/output_test.go +++ b/output/output_test.go @@ -21,7 +21,7 @@ import ( "reflect" "testing" - jsoniter "github.com/json-iterator/go" + "github.com/goccy/go-json" "github.com/stretchr/testify/assert" ) @@ -135,7 +135,6 @@ func Test_merge(t *testing.T) { } func toJson(src map[string]any) string { - json := jsoniter.ConfigCompatibleWithStandardLibrary jsonStr, _ := json.Marshal(src) return string(jsonStr) }