refactor: move from io/ioutil to io and os package (#1772)

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2021-09-27 08:55:23 +08:00
committed by GitHub
parent a2cce0ba77
commit 62af723017
25 changed files with 45 additions and 57 deletions

View File

@@ -7,9 +7,9 @@ import (
"errors"
"fmt"
"io/fs"
"io/ioutil"
"net/http"
"net/url"
"os"
"path"
"runtime/debug"
"strconv"
@@ -344,12 +344,12 @@ func makeTLSConfig(c *config.Instance) (*tls.Config, error) {
return nil, errors.New("SSL key file must be present if certificate file is present")
}
cert, err := ioutil.ReadFile(certFile)
cert, err := os.ReadFile(certFile)
if err != nil {
return nil, fmt.Errorf("error reading SSL certificate file %s: %s", certFile, err.Error())
}
key, err := ioutil.ReadFile(keyFile)
key, err := os.ReadFile(keyFile)
if err != nil {
return nil, fmt.Errorf("error reading SSL key file %s: %s", keyFile, err.Error())
}