spiegel_podman/cmd/podman/registry/json.go
Jhon Honce b21a5b7ff4 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 <jhonce@redhat.com>
2020-04-21 07:56:10 -07:00

20 lines
317 B
Go

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
}