diff --git a/internal/collector/domain_test.go b/internal/collector/domain_test.go index 6a13d47..04dae6f 100644 --- a/internal/collector/domain_test.go +++ b/internal/collector/domain_test.go @@ -1,7 +1,7 @@ package collector import ( - "io/ioutil" + "io" "net/http" "net/http/httptest" "regexp" @@ -46,7 +46,7 @@ func testCollector(t *testing.T, collector prometheus.Collector, checker func(t resp, err := http.Get(srv.URL) is.NoErr(err) // expected no error - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) is.NoErr(err) // expected no error checker(t, resp.StatusCode, string(body)) } diff --git a/internal/safeconfig/safeconfig.go b/internal/safeconfig/safeconfig.go index f85945b..9506ca3 100644 --- a/internal/safeconfig/safeconfig.go +++ b/internal/safeconfig/safeconfig.go @@ -2,7 +2,7 @@ package safeconfig import ( "fmt" - "io/ioutil" + "os" "path/filepath" "github.com/rs/zerolog/log" @@ -35,7 +35,7 @@ func (cfg *SafeConfig) Reload(pathToFile string) error { } log.Debug().Msgf("absolute path of config file is %s", filename) - yamlFile, err := ioutil.ReadFile(filename) + yamlFile, err := os.ReadFile(filename) if err != nil { return fmt.Errorf("failed to read file: %w", err) } diff --git a/internal/safeconfig/safeconfig_test.go b/internal/safeconfig/safeconfig_test.go index 02798a8..b4f92a9 100644 --- a/internal/safeconfig/safeconfig_test.go +++ b/internal/safeconfig/safeconfig_test.go @@ -1,7 +1,6 @@ package safeconfig import ( - "io/ioutil" "os" "reflect" "testing" @@ -82,7 +81,7 @@ domains: } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - file, err := ioutil.TempFile(os.TempDir(), "temp.*.yaml") + file, err := os.CreateTemp(os.TempDir(), "temp.*.yaml") if err != nil { log.Fatal().Err(err) }