Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit 000c429

Browse files
committed
fix: ioutil deprecation
1 parent e2d841e commit 000c429

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

internal/runner/validator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"encoding/base64"
66
"encoding/json"
77
"fmt"
8-
"io/ioutil"
8+
"io"
99
"net/http"
1010
"os"
1111
"reflect"
@@ -131,7 +131,7 @@ func zinc(options *common.Options) string {
131131
}
132132
defer resp.Body.Close()
133133

134-
body, err := ioutil.ReadAll(resp.Body)
134+
body, err := io.ReadAll(resp.Body)
135135
if err != nil {
136136
errors.Exit(fmt.Sprint(errors.ErrHealthZinc, ": ", err.Error()))
137137
}
@@ -163,7 +163,7 @@ func zinc(options *common.Options) string {
163163
}
164164
defer resp.Body.Close()
165165

166-
body, err = ioutil.ReadAll(resp.Body)
166+
body, err = io.ReadAll(resp.Body)
167167
if err != nil {
168168
errors.Exit(fmt.Sprint(errors.ErrAuthZinc, ": ", err.Error()))
169169
}

pkg/logs/zinc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"encoding/json"
66
"errors"
77
"fmt"
8-
"io/ioutil"
8+
"io"
99
"net/http"
1010

1111
e "teler.app/pkg/errors"
@@ -34,7 +34,7 @@ func Zinc(base string, index string, auth string, log map[string]string) error {
3434
}
3535
defer resp.Body.Close()
3636

37-
body, err := ioutil.ReadAll(resp.Body)
37+
body, err := io.ReadAll(resp.Body)
3838
if err != nil {
3939
return err
4040
}

pkg/parsers/get.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package parsers
22

33
import (
4-
"io/ioutil"
4+
"os"
55

66
"gopkg.in/yaml.v2"
77
)
88

99
// GetConfig will parse the config file
1010
func GetConfig(f string) (*Configs, error) {
1111
config := &Configs{}
12-
file, err := ioutil.ReadFile(f)
12+
file, err := os.ReadFile(f)
1313
if err != nil {
1414
return nil, err
1515
}

pkg/requests/resources.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package requests
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"net/http"
66
"os"
77
"path/filepath"
@@ -60,7 +60,7 @@ func getRules(options *common.Options) {
6060
spin.Suffix = " Getting \"" + cat + "\" resource..."
6161

6262
if cache.Check() && isCached {
63-
content, errCon = ioutil.ReadFile(filepath.Join(cache.Path, fname))
63+
content, errCon = os.ReadFile(filepath.Join(cache.Path, fname))
6464
if errCon != nil {
6565
cache.Purge()
6666

@@ -81,7 +81,7 @@ func getRules(options *common.Options) {
8181
errors.Exit(err.Error())
8282
}
8383

84-
content, errCon = ioutil.ReadAll(res.Body)
84+
content, errCon = io.ReadAll(res.Body)
8585
if errCon != nil {
8686
errors.Exit(errCon.Error())
8787
}

0 commit comments

Comments
 (0)