chore: replace ioutil -> io

This commit is contained in:
henry.chen
2024-11-04 10:31:28 +08:00
parent 27bc610a31
commit 6e1965a764
8 changed files with 27 additions and 26 deletions

View File

@@ -6,7 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"regexp"
"strings"
@@ -160,7 +160,7 @@ func createIndexAndMappings(index, typ string, mappings []byte) error {
return err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
return err
}
@@ -183,7 +183,7 @@ func indexOrUpdateDocument(index, typ string, id int, doc []byte) (err error) {
return err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
return err
}
@@ -220,7 +220,7 @@ func deleteIndexDocument(index, typ string, ids []string) error {
return err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
return err
}
@@ -272,7 +272,7 @@ func indexQueryDSL(index, typ string, size, from int, dsl []byte) (*SearchIndexR
return nil, err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}