Skip to content

Commit 2f87939

Browse files
committed
fix linter
1 parent ebcf07c commit 2f87939

File tree

6 files changed

+11
-15
lines changed

6 files changed

+11
-15
lines changed

client/elasticClientCommon.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func loadResponseBody(body io.ReadCloser, dest interface{}) error {
4646
return nil
4747
}
4848
if dest == nil {
49-
_, err := io.Copy(ioutil.Discard, body)
49+
_, err := io.Copy(io.Discard, body)
5050
return err
5151
}
5252

@@ -56,7 +56,7 @@ func loadResponseBody(body io.ReadCloser, dest interface{}) error {
5656

5757
func elasticDefaultErrorResponseHandler(res *esapi.Response) error {
5858
responseBody := map[string]interface{}{}
59-
bodyBytes, err := ioutil.ReadAll(res.Body)
59+
bodyBytes, err := io.ReadAll(res.Body)
6060
if err != nil {
6161
return fmt.Errorf("%w cannot read elastic response body bytes", err)
6262
}

client/elasticClientScroll.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"net/http"
99
"strconv"
1010
"time"
@@ -23,9 +23,6 @@ func (ec *elasticClient) DoCountRequest(ctx context.Context, index string, body
2323
if err != nil {
2424
return 0, err
2525
}
26-
if err != nil {
27-
return 0, err
28-
}
2926

3027
bodyBytes, err := getBytesFromResponse(res)
3128
if err != nil {
@@ -139,7 +136,7 @@ func getBytesFromResponse(res *esapi.Response) ([]byte, error) {
139136
}
140137
defer closeBody(res)
141138

142-
bodyBytes, err := ioutil.ReadAll(res.Body)
139+
bodyBytes, err := io.ReadAll(res.Body)
143140
if err != nil {
144141
return nil, err
145142
}

client/elasticClientScroll_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package client
22

33
import (
44
"context"
5-
"io/ioutil"
5+
"io"
66
"net/http"
77
"net/http/httptest"
88
"os"
@@ -24,7 +24,7 @@ func TestElasticClient_DoCountRequest(t *testing.T) {
2424
jsonFile, err := os.Open("./testsData/response-count-request.json")
2525
require.Nil(t, err)
2626

27-
byteValue, _ := ioutil.ReadAll(jsonFile)
27+
byteValue, _ := io.ReadAll(jsonFile)
2828
_, _ = w.Write(byteValue)
2929
}
3030

client/logging/customLogger.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package logging
22

33
import (
44
"io"
5-
"io/ioutil"
65
"net/http"
76
"time"
87

@@ -28,10 +27,10 @@ func (cl *CustomLogger) LogRoundTrip(
2827
)
2928

3029
if req != nil && req.Body != nil && req.Body != http.NoBody {
31-
reqSize, _ = io.Copy(ioutil.Discard, req.Body)
30+
reqSize, _ = io.Copy(io.Discard, req.Body)
3231
}
3332
if res != nil && res.Body != nil && res.Body != http.NoBody {
34-
resSize, _ = io.Copy(ioutil.Discard, res.Body)
33+
resSize, _ = io.Copy(io.Discard, res.Body)
3534
}
3635

3736
if err != nil {

integrationtests/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"fmt"
66
"io"
7-
"io/ioutil"
87
"net/http"
98
"net/url"
109
"os"
@@ -22,6 +21,7 @@ import (
2221
)
2322

2423
var (
24+
// nolint
2525
log = logger.GetOrCreate("integration-tests")
2626
pubKeyConverter, _ = pubkeyConverter.NewBech32PubkeyConverter(32, addressPrefix)
2727
)
@@ -93,7 +93,7 @@ func getIndexMappings(index string) (string, error) {
9393
return "", err
9494
}
9595

96-
body, err := ioutil.ReadAll(res.Body)
96+
body, err := io.ReadAll(res.Body)
9797
if err != nil {
9898
return "", err
9999
}

process/elasticproc/transactions/serialize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func prepareNFTESDTTransferOrMultiESDTTransfer(marshaledTx []byte) ([]byte, erro
279279
}
280280

281281
func isNFTTransferOrMultiTransfer(tx *data.Transaction) bool {
282-
if len(tx.SmartContractResults) < 0 || tx.SenderShard != tx.ReceiverShard {
282+
if tx.SenderShard != tx.ReceiverShard {
283283
return false
284284
}
285285

0 commit comments

Comments
 (0)