Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill committed Jul 11, 2024
1 parent d206d79 commit 0dccbce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions basic/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package basic
import (
"bytes"
"flag"
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
Expand All @@ -19,7 +19,7 @@ var (
func readTestDataMetrics(t *testing.T) []string {
t.Helper()

b, err := ioutil.ReadFile(filepath.Join("testdata", "all.txt")) //nolint:gosec
b, err := os.ReadFile(filepath.Join("testdata", "all.txt")) //nolint:gosec
require.NoError(t, err)
return strings.Split(string(bytes.TrimSpace(b)), "\n")
}
Expand All @@ -28,6 +28,6 @@ func writeTestDataMetrics(t *testing.T, metrics []string) {
t.Helper()

b := []byte(strings.TrimSpace(strings.Join(metrics, "\n")) + "\n")
err := ioutil.WriteFile(filepath.Join("testdata", "all.txt"), b, 0666)
err := os.WriteFile(filepath.Join("testdata", "all.txt"), b, 0666)
require.NoError(t, err)
}
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package config

import (
"io/ioutil"
"os"

"gopkg.in/yaml.v2"
)
Expand Down Expand Up @@ -46,7 +46,7 @@ type Config struct {

// Load loads configuration from file.
func Load(filename string) (*Config, error) {
b, err := ioutil.ReadFile(filename) //nolint:gosec
b, err := os.ReadFile(filename) //nolint:gosec
if err != nil {
return nil, err
}
Expand Down
10 changes: 5 additions & 5 deletions enhanced/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"flag"
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
Expand All @@ -20,7 +20,7 @@ var (
func readTestDataJSON(t *testing.T, instance string) []byte {
t.Helper()

b, err := ioutil.ReadFile(filepath.Join("testdata", instance+".json")) //nolint:gosec
b, err := os.ReadFile(filepath.Join("testdata", instance+".json")) //nolint:gosec
require.NoError(t, err)
return bytes.TrimSpace(b)
}
Expand All @@ -33,14 +33,14 @@ func writeTestDataJSON(t *testing.T, instance string, b []byte) {
require.NoError(t, err)
err = buf.WriteByte('\n')
require.NoError(t, err)
err = ioutil.WriteFile(filepath.Join("testdata", instance+".json"), buf.Bytes(), 0666)
err = os.WriteFile(filepath.Join("testdata", instance+".json"), buf.Bytes(), 0666)
require.NoError(t, err)
}

func readTestDataMetrics(t *testing.T, instance string) []string {
t.Helper()

b, err := ioutil.ReadFile(filepath.Join("testdata", instance+".txt")) //nolint:gosec
b, err := os.ReadFile(filepath.Join("testdata", instance+".txt")) //nolint:gosec
require.NoError(t, err)
return strings.Split(string(bytes.TrimSpace(b)), "\n")
}
Expand All @@ -49,6 +49,6 @@ func writeTestDataMetrics(t *testing.T, instance string, metrics []string) {
t.Helper()

b := []byte(strings.TrimSpace(strings.Join(metrics, "\n")) + "\n")
err := ioutil.WriteFile(filepath.Join("testdata", instance+".txt"), b, 0666)
err := os.WriteFile(filepath.Join("testdata", instance+".txt"), b, 0666)
require.NoError(t, err)
}

0 comments on commit 0dccbce

Please sign in to comment.