From b21a5b7ff470612e2bde5f120aecfbc1a0881689 Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Thu, 16 Apr 2020 12:06:36 -0700 Subject: Provide a json variable pointing to a configured json API * All commands now using the same instance of json API * `json` variable created in each package to prevent `encoding/json` from being re-introduced Signed-off-by: Jhon Honce --- cmd/podman/registry/json.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 cmd/podman/registry/json.go (limited to 'cmd/podman/registry/json.go') diff --git a/cmd/podman/registry/json.go b/cmd/podman/registry/json.go new file mode 100644 index 000000000..f25406c3c --- /dev/null +++ b/cmd/podman/registry/json.go @@ -0,0 +1,20 @@ +package registry + +import ( + "sync" + + jsoniter "github.com/json-iterator/go" +) + +var ( + json jsoniter.API + jsonSync sync.Once +) + +// JsonLibrary provides a "encoding/json" compatible API +func JsonLibrary() jsoniter.API { + jsonSync.Do(func() { + json = jsoniter.ConfigCompatibleWithStandardLibrary + }) + return json +} -- cgit v1.2.3-54-g00ecf