ax(node): replace banned encoding/json import with package UnmarshalJSON wrapper in lethean.go
Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
09a87eb021
commit
882dff4afc
1 changed files with 3 additions and 4 deletions
|
|
@ -5,7 +5,6 @@ package node
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
|
@ -52,7 +51,7 @@ func GetChainInfo(daemonURL string) (*ChainInfo, error) {
|
|||
var rpcResponse struct {
|
||||
Result ChainInfo `json:"result"`
|
||||
}
|
||||
if err := json.Unmarshal(responseBody, &rpcResponse); err != nil {
|
||||
if err := UnmarshalJSON(responseBody, &rpcResponse); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rpcResponse.Result.Synced = rpcResponse.Result.Height > 0
|
||||
|
|
@ -79,7 +78,7 @@ func DiscoverPools(daemonURL string) []PoolGateway {
|
|||
} `json:"aliases"`
|
||||
} `json:"result"`
|
||||
}
|
||||
json.Unmarshal(responseBody, &rpcResponse)
|
||||
UnmarshalJSON(responseBody, &rpcResponse) //nolint:errcheck
|
||||
|
||||
var pools []PoolGateway
|
||||
for _, alias := range rpcResponse.Result.Aliases {
|
||||
|
|
@ -117,7 +116,7 @@ func DiscoverGateways(daemonURL string) []PoolGateway {
|
|||
} `json:"aliases"`
|
||||
} `json:"result"`
|
||||
}
|
||||
json.Unmarshal(responseBody, &rpcResponse)
|
||||
UnmarshalJSON(responseBody, &rpcResponse) //nolint:errcheck
|
||||
|
||||
var gateways []PoolGateway
|
||||
for _, alias := range rpcResponse.Result.Aliases {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue