*: apply go 1.19 formatter heuristics
And make manual corrections where needed. See the "Common mistakes and pitfalls" section of https://tip.golang.org/doc/comment.
This commit is contained in:
parent
bb751535d3
commit
916f2293b8
20 changed files with 167 additions and 150 deletions
|
@ -36,12 +36,13 @@ var ErrTooDeep = errors.New("too deep")
|
|||
|
||||
// ToJSON encodes Item to JSON.
|
||||
// It behaves as following:
|
||||
// ByteArray -> base64 string
|
||||
// BigInteger -> number
|
||||
// Bool -> bool
|
||||
// Null -> null
|
||||
// Array, Struct -> array
|
||||
// Map -> map with keys as UTF-8 bytes
|
||||
//
|
||||
// ByteArray -> base64 string
|
||||
// BigInteger -> number
|
||||
// Bool -> bool
|
||||
// Null -> null
|
||||
// Array, Struct -> array
|
||||
// Map -> map with keys as UTF-8 bytes
|
||||
func ToJSON(item Item) ([]byte, error) {
|
||||
seen := make(map[Item]sliceNoPointer, typicalNumOfItems)
|
||||
return toJSON(nil, seen, item)
|
||||
|
@ -153,12 +154,13 @@ func itemToJSONString(it Item) ([]byte, error) {
|
|||
|
||||
// FromJSON decodes an Item from JSON.
|
||||
// It behaves as following:
|
||||
// string -> ByteArray from base64
|
||||
// number -> BigInteger
|
||||
// bool -> Bool
|
||||
// null -> Null
|
||||
// array -> Array
|
||||
// map -> Map, keys are UTF-8
|
||||
//
|
||||
// string -> ByteArray from base64
|
||||
// number -> BigInteger
|
||||
// bool -> Bool
|
||||
// null -> Null
|
||||
// array -> Array
|
||||
// map -> Map, keys are UTF-8
|
||||
func FromJSON(data []byte, maxCount int) (Item, error) {
|
||||
d := decoder{
|
||||
Decoder: *json.NewDecoder(bytes.NewReader(data)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue