Skip to content

Commit 3414a80

Browse files
committed
add drop-in json library adapter
1 parent 6785b52 commit 3414a80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+219
-85
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
OVS_VERSION ?= v2.16.0
2+
TAG ?= std
23

34
.PHONY: all
45
all: lint build test integration-test coverage
@@ -14,14 +15,14 @@ prebuild: modelgen ovsdb/serverdb/_server.ovsschema example/vswitchd/ovs.ovssche
1415
@go generate -v ./...
1516

1617
.PHONY: build
17-
build: prebuild
18+
build: prebuild
1819
@echo "+ $@"
1920
@go build -v ./...
2021

2122
.PHONY: test
2223
test: prebuild
2324
@echo "+ $@"
24-
@go test -race -coverprofile=unit.cov -test.short -timeout 30s -v ./...
25+
@go test -race -coverprofile=unit.cov -tags $(TAG) -test.short -timeout 30s -v ./...
2526

2627
.PHONY: integration-test
2728
integration-test:
@@ -36,7 +37,7 @@ coverage: test integration-test
3637
.PHONY: bench
3738
bench: install-deps prebuild
3839
@echo "+ $@"
39-
@go test -run=XXX -count=3 -bench=. ./... | tee bench.out
40+
@go test -run=XXX -count=3 -tags $(TAG) -bench=. ./... | tee bench.out
4041
@benchstat bench.out
4142

4243
.PHONY: install-deps

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,73 @@ In your application, load the ClientDBModel, connect to the server and start int
307307
fmt.Printf("My Router has UUID: %s and %d Ports\n", lr.UUID, len(lr.Ports))
308308
}
309309

310+
## Drop-in json library
311+
312+
There are two json libraries to use as a drop-in replacement for std json library.
313+
[go-json](https://github.com/goccy/go-json) and [json-iterator](https://github.com/json-iterator/go)
314+
315+
go build your application with -tags go_json or jsoniter
316+
317+
$ benchstat bench.out.std bench.out.jsoniter bench.out.go_json
318+
goos: linux
319+
goarch: amd64
320+
pkg: github.com/ovn-org/libovsdb/ovsdb
321+
cpu: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
322+
│ bench.out.std │ bench.out.jsoniter │ bench.out.go_json │
323+
│ sec/op │ sec/op vs base │ sec/op vs base │
324+
MapMarshalJSON1-4 2.234µ ± ∞ ¹ 1.621µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.289µ ± ∞ ¹ ~ (p=0.100 n=3) ²
325+
MapMarshalJSON2-4 3.109µ ± ∞ ¹ 2.283µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.834µ ± ∞ ¹ ~ (p=0.100 n=3) ²
326+
MapMarshalJSON3-4 4.165µ ± ∞ ¹ 2.900µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.404µ ± ∞ ¹ ~ (p=0.100 n=3) ²
327+
MapMarshalJSON5-4 6.058µ ± ∞ ¹ 4.119µ ± ∞ ¹ ~ (p=0.100 n=3) ² 3.421µ ± ∞ ¹ ~ (p=0.100 n=3) ²
328+
MapMarshalJSON8-4 8.978µ ± ∞ ¹ 5.685µ ± ∞ ¹ ~ (p=0.100 n=3) ² 4.912µ ± ∞ ¹ ~ (p=0.100 n=3) ²
329+
MapUnmarshalJSON1-4 3.208µ ± ∞ ¹ 2.437µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.944µ ± ∞ ¹ ~ (p=0.100 n=3) ²
330+
MapUnmarshalJSON2-4 4.525µ ± ∞ ¹ 3.579µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.659µ ± ∞ ¹ ~ (p=0.100 n=3) ²
331+
MapUnmarshalJSON3-4 6.015µ ± ∞ ¹ 4.780µ ± ∞ ¹ ~ (p=0.100 n=3) ² 3.404µ ± ∞ ¹ ~ (p=0.100 n=3) ²
332+
MapUnmarshalJSON5-4 9.121µ ± ∞ ¹ 7.061µ ± ∞ ¹ ~ (p=0.100 n=3) ² 4.914µ ± ∞ ¹ ~ (p=0.100 n=3) ²
333+
MapUnmarshalJSON8-4 13.912µ ± ∞ ¹ 10.242µ ± ∞ ¹ ~ (p=0.100 n=3) ² 7.076µ ± ∞ ¹ ~ (p=0.100 n=3) ²
334+
SetMarshalJSONString1-4 668.7n ± ∞ ¹ 511.9n ± ∞ ¹ ~ (p=0.100 n=3) ² 393.8n ± ∞ ¹ ~ (p=0.100 n=3) ²
335+
SetMarshalJSONString2-4 1756.0n ± ∞ ¹ 1243.0n ± ∞ ¹ ~ (p=0.100 n=3) ² 972.6n ± ∞ ¹ ~ (p=0.100 n=3) ²
336+
SetMarshalJSONString3-4 1.977µ ± ∞ ¹ 1.320µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.082µ ± ∞ ¹ ~ (p=0.100 n=3) ²
337+
SetMarshalJSONString5-4 2.463µ ± ∞ ¹ 1.561µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.327µ ± ∞ ¹ ~ (p=0.100 n=3) ²
338+
SetMarshalJSONString8-4 3.310µ ± ∞ ¹ 1.929µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.647µ ± ∞ ¹ ~ (p=0.100 n=3) ²
339+
SetMarshalJSONInt1-4 605.4n ± ∞ ¹ 495.1n ± ∞ ¹ ~ (p=0.100 n=3) ² 405.5n ± ∞ ¹ ~ (p=0.100 n=3) ²
340+
SetMarshalJSONInt2-4 1.612µ ± ∞ ¹ 1.253µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.057µ ± ∞ ¹ ~ (p=0.100 n=3) ²
341+
SetMarshalJSONInt3-4 1.766µ ± ∞ ¹ 1.327µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.200µ ± ∞ ¹ ~ (p=0.100 n=3) ²
342+
SetMarshalJSONInt5-4 2.082µ ± ∞ ¹ 1.560µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.423µ ± ∞ ¹ ~ (p=0.100 n=3) ²
343+
SetMarshalJSONInt8-4 2.554µ ± ∞ ¹ 1.906µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.772µ ± ∞ ¹ ~ (p=0.100 n=3) ²
344+
SetMarshalJSONFloat1-4 676.8n ± ∞ ¹ 562.1n ± ∞ ¹ ~ (p=0.100 n=3) ² 489.2n ± ∞ ¹ ~ (p=0.100 n=3) ²
345+
SetMarshalJSONFloat2-4 1.599µ ± ∞ ¹ 1.205µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.025µ ± ∞ ¹ ~ (p=0.100 n=3) ²
346+
SetMarshalJSONFloat3-4 1.761µ ± ∞ ¹ 1.341µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.148µ ± ∞ ¹ ~ (p=0.100 n=3) ²
347+
SetMarshalJSONFloat5-4 2.090µ ± ∞ ¹ 1.576µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.379µ ± ∞ ¹ ~ (p=0.100 n=3) ²
348+
SetMarshalJSONFloat8-4 2.543µ ± ∞ ¹ 1.902µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.720µ ± ∞ ¹ ~ (p=0.100 n=3) ²
349+
SetMarshalJSONUUID1-4 1227.0n ± ∞ ¹ 570.0n ± ∞ ¹ ~ (p=0.100 n=3) ² 485.8n ± ∞ ¹ ~ (p=0.100 n=3) ²
350+
SetMarshalJSONUUID2-4 2.875µ ± ∞ ¹ 1.311µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.142µ ± ∞ ¹ ~ (p=0.100 n=3) ²
351+
SetMarshalJSONUUID3-4 3.594µ ± ∞ ¹ 1.490µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.313µ ± ∞ ¹ ~ (p=0.100 n=3) ²
352+
SetMarshalJSONUUID5-4 5.184µ ± ∞ ¹ 1.832µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.674µ ± ∞ ¹ ~ (p=0.100 n=3) ²
353+
SetMarshalJSONUUID8-4 7.555µ ± ∞ ¹ 2.333µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.252µ ± ∞ ¹ ~ (p=0.100 n=3) ²
354+
SetUnmarshalJSONString1-4 848.8n ± ∞ ¹ 769.3n ± ∞ ¹ ~ (p=0.100 n=3) ² 517.0n ± ∞ ¹ ~ (p=0.100 n=3) ²
355+
SetUnmarshalJSONString2-4 2.722µ ± ∞ ¹ 2.270µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.684µ ± ∞ ¹ ~ (p=0.100 n=3) ²
356+
SetUnmarshalJSONString3-4 3.264µ ± ∞ ¹ 2.790µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.940µ ± ∞ ¹ ~ (p=0.100 n=3) ²
357+
SetUnmarshalJSONString5-4 4.482µ ± ∞ ¹ 3.580µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.414µ ± ∞ ¹ ~ (p=0.100 n=3) ²
358+
SetUnmarshalJSONString8-4 5.980µ ± ∞ ¹ 4.519µ ± ∞ ¹ ~ (p=0.100 n=3) ² 3.010µ ± ∞ ¹ ~ (p=0.100 n=3) ²
359+
SetUnmarshalJSONInt1-4 741.6n ± ∞ ¹ 942.9n ± ∞ ¹ ~ (p=0.100 n=3) ² 514.6n ± ∞ ¹ ~ (p=0.100 n=3) ²
360+
SetUnmarshalJSONInt2-4 2.394µ ± ∞ ¹ 2.236µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.709µ ± ∞ ¹ ~ (p=0.100 n=3) ²
361+
SetUnmarshalJSONInt3-4 2.839µ ± ∞ ¹ 2.667µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.048µ ± ∞ ¹ ~ (p=0.100 n=3) ²
362+
SetUnmarshalJSONInt5-4 3.521µ ± ∞ ¹ 3.425µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.497µ ± ∞ ¹ ~ (p=0.100 n=3) ²
363+
SetUnmarshalJSONInt8-4 4.383µ ± ∞ ¹ 4.227µ ± ∞ ¹ ~ (p=0.100 n=3) ² 3.066µ ± ∞ ¹ ~ (p=0.100 n=3) ²
364+
SetUnmarshalJSONFloat1-4 845.2n ± ∞ ¹ 960.0n ± ∞ ¹ ~ (p=0.100 n=3) ² 541.3n ± ∞ ¹ ~ (p=0.100 n=3) ²
365+
SetUnmarshalJSONFloat2-4 2.606µ ± ∞ ¹ 2.264µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.748µ ± ∞ ¹ ~ (p=0.100 n=3) ²
366+
SetUnmarshalJSONFloat3-4 3.141µ ± ∞ ¹ 2.667µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.040µ ± ∞ ¹ ~ (p=0.100 n=3) ²
367+
SetUnmarshalJSONFloat5-4 4.118µ ± ∞ ¹ 3.436µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.560µ ± ∞ ¹ ~ (p=0.100 n=3) ²
368+
SetUnmarshalJSONFloat8-4 5.149µ ± ∞ ¹ 4.286µ ± ∞ ¹ ~ (p=0.100 n=3) ² 3.141µ ± ∞ ¹ ~ (p=0.100 n=3) ²
369+
SetUnmarshalJSONUUID1-4 1802.0n ± ∞ ¹ 879.3n ± ∞ ¹ ~ (p=0.100 n=3) ² 613.5n ± ∞ ¹ ~ (p=0.100 n=3) ²
370+
SetUnmarshalJSONUUID2-4 5.697µ ± ∞ ¹ 2.503µ ± ∞ ¹ ~ (p=0.100 n=3) ² 1.899µ ± ∞ ¹ ~ (p=0.100 n=3) ²
371+
SetUnmarshalJSONUUID3-4 7.469µ ± ∞ ¹ 3.035µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.218µ ± ∞ ¹ ~ (p=0.100 n=3) ²
372+
SetUnmarshalJSONUUID5-4 11.604µ ± ∞ ¹ 3.965µ ± ∞ ¹ ~ (p=0.100 n=3) ² 2.987µ ± ∞ ¹ ~ (p=0.100 n=3) ²
373+
SetUnmarshalJSONUUID8-4 17.097µ ± ∞ ¹ 5.168µ ± ∞ ¹ ~ (p=0.100 n=3) ² 3.731µ ± ∞ ¹ ~ (p=0.100 n=3) ²
374+
geomean 2.982µ 2.057µ -31.03% 1.606µ -46.14%
375+
¹ need >= 6 samples for confidence interval at level 0.95
376+
² need >= 4 samples to detect a difference at alpha level 0.05
310377

311378
## Running the tests
312379

cache/cache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package cache
22

33
import (
4-
"encoding/json"
54
"fmt"
65
"math/rand"
76
"testing"
87

98
"github.com/go-logr/logr"
9+
"github.com/ovn-org/libovsdb/internal/json"
1010
"github.com/ovn-org/libovsdb/model"
1111
"github.com/ovn-org/libovsdb/ovsdb"
1212
"github.com/ovn-org/libovsdb/test"

cache/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Package cache provides a cache of model.Model elements that can be used in an OV
33
44
The cache can be accessed using a simple API:
55
6-
cache.Table("Open_vSwitch").Row("<ovs-uuid>")
6+
cache.Table("Open_vSwitch").Row("<ovs-uuid>")
77
88
It implements the ovsdb.NotificationHandler interface
99
such that it can be populated automatically by

client/api_test_model.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package client
22

33
import (
4-
"encoding/json"
54
"testing"
65

76
"github.com/ovn-org/libovsdb/cache"
7+
"github.com/ovn-org/libovsdb/internal/json"
88
"github.com/ovn-org/libovsdb/model"
99
"github.com/ovn-org/libovsdb/ovsdb"
1010
"github.com/stretchr/testify/assert"
@@ -128,7 +128,7 @@ func (*testLogicalSwitch) Table() string {
128128
return "Logical_Switch"
129129
}
130130

131-
//LogicalSwitchPort struct defines an object in Logical_Switch_Port table
131+
// LogicalSwitchPort struct defines an object in Logical_Switch_Port table
132132
type testLogicalSwitchPort struct {
133133
UUID string `ovsdb:"_uuid"`
134134
Up *bool `ovsdb:"up"`

client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package client
33
import (
44
"context"
55
"crypto/tls"
6-
"encoding/json"
76
"errors"
87
"fmt"
98
"log"
@@ -21,6 +20,7 @@ import (
2120
"github.com/go-logr/logr"
2221
"github.com/go-logr/stdr"
2322
"github.com/ovn-org/libovsdb/cache"
23+
"github.com/ovn-org/libovsdb/internal/json"
2424
"github.com/ovn-org/libovsdb/mapper"
2525
"github.com/ovn-org/libovsdb/model"
2626
"github.com/ovn-org/libovsdb/ovsdb"

client/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package client
22

33
import (
44
"context"
5-
"encoding/json"
65
"fmt"
76
"math/rand"
87
"os"
@@ -17,6 +16,7 @@ import (
1716
"github.com/google/uuid"
1817
"github.com/ovn-org/libovsdb/cache"
1918
db "github.com/ovn-org/libovsdb/database"
19+
"github.com/ovn-org/libovsdb/internal/json"
2020
"github.com/ovn-org/libovsdb/mapper"
2121
"github.com/ovn-org/libovsdb/model"
2222
"github.com/ovn-org/libovsdb/ovsdb"

client/doc.go

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,29 @@ Package client connects to, monitors and interacts with OVSDB servers (RFC7047).
44
This package uses structs, that contain the 'ovs' field tag to determine which field goes to
55
which column in the database. We refer to pointers to this structs as Models. Example:
66
7-
type MyLogicalSwitch struct {
8-
UUID string `ovsdb:"_uuid"` // _uuid tag is mandatory
9-
Name string `ovsdb:"name"`
10-
Ports []string `ovsdb:"ports"`
11-
Config map[string]string `ovsdb:"other_config"`
12-
}
7+
type MyLogicalSwitch struct {
8+
UUID string `ovsdb:"_uuid"` // _uuid tag is mandatory
9+
Name string `ovsdb:"name"`
10+
Ports []string `ovsdb:"ports"`
11+
Config map[string]string `ovsdb:"other_config"`
12+
}
1313
1414
Based on these Models a Database Model (see ClientDBModel type) is built to represent
1515
the entire OVSDB:
1616
17-
clientDBModel, _ := client.NewClientDBModel("OVN_Northbound",
18-
map[string]client.Model{
19-
"Logical_Switch": &MyLogicalSwitch{},
20-
})
21-
17+
clientDBModel, _ := client.NewClientDBModel("OVN_Northbound",
18+
map[string]client.Model{
19+
"Logical_Switch": &MyLogicalSwitch{},
20+
})
2221
2322
The ClientDBModel represents the entire Database (or the part of it we're interested in).
2423
Using it, the libovsdb.client package is able to properly encode and decode OVSDB messages
2524
and store them in Model instances.
2625
A client instance is created by simply specifying the connection information and the database model:
2726
28-
ovs, _ := client.Connect(context.Background(), clientDBModel)
27+
ovs, _ := client.Connect(context.Background(), clientDBModel)
2928
30-
Main API
29+
# Main API
3130
3231
After creating a OvsdbClient using the Connect() function, we can use a number of CRUD-like
3332
to interact with the database:
@@ -43,7 +42,7 @@ and passed to client.Transact().
4342
Others, such as List() and Get(), interact with the client's internal cache and are able to
4443
return Model instances (or a list thereof) directly.
4544
46-
Conditions
45+
# Conditions
4746
4847
Some API functions (Create() and Get()), can be run directly. Others, require us to use
4948
a ConditionalAPI. The ConditionalAPI injects RFC7047 Conditions into ovsdb Operations as well as
@@ -111,15 +110,15 @@ cache element, an operation will be created matching on the "_uuid" column. The
111110
quite large depending on the cache size and the provided function. Most likely there is a way to express the
112111
same condition using Where() or WhereAll() which will be more efficient.
113112
114-
Get
113+
# Get
115114
116115
Get() operation is a simple operation capable of retrieving one Model based on some of its schema indexes. E.g:
117116
118117
ls := &LogicalSwitch{UUID:"myUUID"}
119118
err := ovs.Get(ls)
120119
fmt.Printf("Name of the switch is: &s", ls.Name)
121120
122-
List
121+
# List
123122
124123
List() searches the cache and populates a slice of Models. It can be used directly or using WhereCache()
125124
@@ -131,7 +130,7 @@ List() searches the cache and populates a slice of Models. It can be used direct
131130
return strings.HasPrefix(ls.Name, "ext_")
132131
}).List(lsList)
133132
134-
Create
133+
# Create
135134
136135
Create returns a list of operations to create the models provided. E.g:
137136
@@ -143,7 +142,7 @@ Update returns a list of operations to update the matching rows to match the val
143142
ls := &LogicalSwitch{ExternalIDs: map[string]string {"foo": "bar"}}
144143
ops, err := ovs.Where(...).Update(&ls, &ls.ExternalIDs}
145144
146-
Mutate
145+
# Mutate
147146
148147
Mutate returns a list of operations needed to mutate the matching rows as described by the list of Mutation objects. E.g:
149148
@@ -154,11 +153,10 @@ Mutate returns a list of operations needed to mutate the matching rows as descri
154153
Value: map[string]string{"foo":"bar"},
155154
})
156155
157-
Delete
156+
# Delete
158157
159158
Delete returns a list of operations needed to delete the matching rows. E.g:
160159
161160
ops, err := ovs.Where(...).Delete()
162-
163161
*/
164162
package client

client/monitor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package client
22

33
import (
4-
"encoding/json"
54
"testing"
65

6+
"github.com/ovn-org/libovsdb/internal/json"
77
"github.com/ovn-org/libovsdb/model"
88
"github.com/ovn-org/libovsdb/ovsdb"
99
"github.com/stretchr/testify/assert"

cmd/modelgen/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package main
22

33
import (
4-
"encoding/json"
54
"flag"
65
"fmt"
76
"io/ioutil"
87
"log"
98
"os"
109
"path/filepath"
1110

11+
"github.com/ovn-org/libovsdb/internal/json"
1212
"github.com/ovn-org/libovsdb/modelgen"
1313
"github.com/ovn-org/libovsdb/ovsdb"
1414
)

cmd/print_schema/print_schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"encoding/json"
54
"flag"
65
"fmt"
76
"io/ioutil"
@@ -10,6 +9,7 @@ import (
109
"runtime"
1110
"runtime/pprof"
1211

12+
"github.com/ovn-org/libovsdb/internal/json"
1313
"github.com/ovn-org/libovsdb/ovsdb"
1414
)
1515

go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ require (
77
github.com/cenkalti/rpc2 v0.0.0-20210604223624-c1acbc6ec984
88
github.com/go-logr/logr v1.2.2
99
github.com/go-logr/stdr v1.2.2
10+
github.com/goccy/go-json v0.10.2
1011
github.com/google/uuid v1.2.0
12+
github.com/json-iterator/go v1.1.12
1113
github.com/ory/dockertest/v3 v3.9.1
1214
github.com/prometheus/client_golang v1.12.1
1315
github.com/stretchr/testify v1.8.0
@@ -36,6 +38,8 @@ require (
3638
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
3739
github.com/mitchellh/mapstructure v1.5.0 // indirect
3840
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
41+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
42+
github.com/modern-go/reflect2 v1.0.2 // indirect
3943
github.com/opencontainers/go-digest v1.0.0 // indirect
4044
github.com/opencontainers/image-spec v1.0.2 // indirect
4145
github.com/opencontainers/runc v1.1.2 // indirect

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
106106
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
107107
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
108108
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
109+
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
110+
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
109111
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
110112
github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
111113
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
@@ -178,6 +180,7 @@ github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX
178180
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
179181
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
180182
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
183+
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
181184
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
182185
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
183186
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
@@ -203,9 +206,11 @@ github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdx
203206
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 h1:rzf0wL0CHVc8CEsgyygG0Mn9CNCCPZqOPaz8RiiHYQk=
204207
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc=
205208
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
209+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
206210
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
207211
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
208212
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
213+
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
209214
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
210215
github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
211216
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=

internal/json/go_json.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//go:build go_json
2+
3+
package json
4+
5+
import json "github.com/goccy/go-json"
6+
7+
var (
8+
Marshal = json.Marshal
9+
Unmarshal = json.Unmarshal
10+
MarshalIndent = json.MarshalIndent
11+
)
12+
13+
type RawMessage = json.RawMessage

0 commit comments

Comments
 (0)