chore: remove refs to deprecated io/ioutil (#322)

Thanks!
This commit is contained in:
guangwu
2023-07-23 04:02:24 +08:00
committed by GitHub
parent 7f925565a6
commit 596d28efbd
4 changed files with 8 additions and 10 deletions
+2 -3
View File
@@ -17,7 +17,6 @@ import (
"github.com/rs/zerolog"
"gopkg.in/amz.v3/aws"
"gopkg.in/amz.v3/s3"
"io/ioutil"
"net/http"
"os"
"path/filepath"
@@ -328,11 +327,11 @@ func parseConfigFile(configFileLocation string) (*config.Config, error) {
}
*/
files, _ := ioutil.ReadDir(configFileLocation)
files, _ := os.ReadDir(configFileLocation)
for _, f := range files {
canonicalName := filepath.Join(configFileLocation, f.Name())
bs, _ := ioutil.ReadFile(canonicalName)
bs, _ := os.ReadFile(canonicalName)
var curRawCfgStruct interface{}
if err := toml.Unmarshal(bs, &curRawCfgStruct); err != nil {
return &cfg, err
+2 -2
View File
@@ -6,7 +6,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/zerolog"
"io/ioutil"
"io"
"log"
"net/http"
"regexp"
@@ -100,7 +100,7 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) {
return
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Printf("Error reading body of %q: %v", c.url, err)
return
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"encoding/hex"
"fmt"
"github.com/rs/zerolog"
"io/ioutil"
"net"
"os"
"path/filepath"
@@ -371,7 +370,7 @@ func (l LDAPOpsHelper) searchMaybeSchemaQuery(h LDAPOpsHandler, baseDN string, s
attrs = append(attrs, &ldap.EntryAttribute{Name: "modifiersName", Values: []string{"cn=Directory Manager"}})
attrs = append(attrs, &ldap.EntryAttribute{Name: "modifyTimeStamp", Values: []string{"Mar 8, 2021, 12:46:29 PM PST (20210308204629Z)"}})
// Iterate through schema attributes provided in schema/ directory
filenames, _ := ioutil.ReadDir("schema")
filenames, _ := os.ReadDir("schema")
for _, filename := range filenames {
attributename := new(string)
*attributename = filename.Name()
+3 -3
View File
@@ -7,7 +7,7 @@ import (
"errors"
"fmt"
"github.com/rs/zerolog"
"io/ioutil"
"io"
"net"
"net/http"
"strings"
@@ -255,7 +255,7 @@ func (s ownCloudSession) getGroups() ([]msgraph.Group, error) {
return nil, err
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
b, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
@@ -326,7 +326,7 @@ func (s ownCloudSession) getUsers(userName string) ([]msgraph.User, error) {
return nil, err
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
b, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}