refactor: move from io/ioutil to io and os packages (#5266)
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. [1]: https://golang.org/doc/go1.16#ioutil Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -82,7 +82,7 @@ func (e *Elastic) Search(indices string, body []byte, scroll bool) ([]byte, erro
|
||||
return nil, parseError(response)
|
||||
}
|
||||
|
||||
return ioutil.ReadAll(response.Body)
|
||||
return io.ReadAll(response.Body)
|
||||
}
|
||||
|
||||
func (e *Elastic) Scroll(id string) ([]byte, error) {
|
||||
@@ -99,7 +99,7 @@ func (e *Elastic) Scroll(id string) ([]byte, error) {
|
||||
return nil, parseError(response)
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadAll(response.Body)
|
||||
b, err := io.ReadAll(response.Body)
|
||||
return b, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user