Replace uses of libs/json with encoding/json. (#7534)

Where possible, replace uses of the custom JSON library with the standard
library. The custom library treats interface and unnamed lteral types
differently, so this change avoids those even where it would probably be safe
to switch them.
This commit is contained in:
M. J. Fromberger
2022-01-08 08:47:26 -08:00
committed by GitHub
parent d5c39f907d
commit 366ab1947a
8 changed files with 21 additions and 19 deletions
+2 -2
View File
@@ -2,6 +2,7 @@ package types
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
@@ -10,7 +11,6 @@ import (
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/libs/bits"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmjson "github.com/tendermint/tendermint/libs/json"
tmmath "github.com/tendermint/tendermint/libs/math"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)
@@ -365,7 +365,7 @@ func (ps *PartSet) MarshalJSON() ([]byte, error) {
ps.mtx.Lock()
defer ps.mtx.Unlock()
return tmjson.Marshal(struct {
return json.Marshal(struct {
CountTotal string `json:"count/total"`
PartsBitArray *bits.BitArray `json:"parts_bit_array"`
}{
+2 -2
View File
@@ -2,12 +2,12 @@ package types
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"sync"
"github.com/tendermint/tendermint/libs/bits"
tmjson "github.com/tendermint/tendermint/libs/json"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)
@@ -495,7 +495,7 @@ func (voteSet *VoteSet) StringIndented(indent string) string {
func (voteSet *VoteSet) MarshalJSON() ([]byte, error) {
voteSet.mtx.Lock()
defer voteSet.mtx.Unlock()
return tmjson.Marshal(VoteSetJSON{
return json.Marshal(VoteSetJSON{
voteSet.voteStrings(),
voteSet.bitArrayString(),
voteSet.peerMaj23s,