Skip to content

Commit

Permalink
resolve golint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentysc committed Nov 25, 2024
1 parent f3c8e8a commit a767924
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions infrastructure/cosmosapp/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"math/big"
"net/http"
"net/url"
Expand Down Expand Up @@ -851,7 +850,7 @@ func (client *HTTPClient) request(method string, queryKVs ...queryKV) (io.ReadCl
defer rawResp.Body.Close()

var rawRespBody []byte
rawRespBody, err = ioutil.ReadAll(rawResp.Body)
rawRespBody, err = io.ReadAll(rawResp.Body)
if err != nil {
return nil, fmt.Errorf("error reading Body : %w", err)
}
Expand Down
5 changes: 2 additions & 3 deletions infrastructure/tendermint/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -208,7 +207,7 @@ func (client *HTTPClient) Status() (*map[string]interface{}, error) {
}
defer rawRespBody.Close()

body, _ := ioutil.ReadAll(rawRespBody)
body, _ := io.ReadAll(rawRespBody)
jsonMap := make(map[string]interface{})
errRead := json.Unmarshal([]byte(body), &jsonMap)
if errRead != nil {
Expand Down Expand Up @@ -253,7 +252,7 @@ func (client *HTTPClient) request(method string, queryKVs ...queryKV) (io.ReadCl
if rawResp.StatusCode != 200 {
defer rawResp.Body.Close()

rawRespBody, err = ioutil.ReadAll(rawResp.Body)
rawRespBody, err = io.ReadAll(rawResp.Body)
if err != nil {
return nil, fmt.Errorf("error reading Body : %w", err)
}
Expand Down
3 changes: 2 additions & 1 deletion test/factory/block.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package factory

import (
crytporand "crypto/rand"
"encoding/base64"
"encoding/hex"
"math/rand"
Expand Down Expand Up @@ -90,7 +91,7 @@ func RandomTxHash() string {
func randomHex(n int) []byte {
placeholder := make([]byte, n)
// nolint:gosec
_, err := rand.Read(placeholder)
_, err := crytporand.Read(placeholder)
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions usecase/parser/utils/mapstructure/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func StringToJsonUint64HookFunc() mapstructure.DecodeHookFunc {
}
return *u, nil
}
if t == reflect.PtrTo(reflect.TypeOf(json.Uint64{})) {
if t == reflect.PointerTo(reflect.TypeOf(json.Uint64{})) {
u, parseErr := json.NewUint64FromString(data.(string))
if parseErr != nil {
return nil, parseErr
Expand Down Expand Up @@ -104,7 +104,7 @@ func StringToJsonNumericStringHookFunc() mapstructure.DecodeHookFunc {
return *u, nil
}

if t == reflect.PtrTo(reflect.TypeOf(json.NumericString{})) {
if t == reflect.PointerTo(reflect.TypeOf(json.NumericString{})) {
u, parseErr := json.NewNumericString(data.(string))
if parseErr != nil {
return nil, parseErr
Expand Down

0 comments on commit a767924

Please sign in to comment.