fix: remove deprecated calls to ioutil

This commit is contained in:
Bruno Carlin 2024-02-29 00:58:42 +01:00
parent 26d78be263
commit 75918ffdb7

View file

@ -6,7 +6,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
)
@ -74,7 +73,7 @@ type Updater interface {
}
func read(path string, data interface{}) error {
content, err := ioutil.ReadFile(filepath.Clean(path))
content, err := os.ReadFile(filepath.Clean(path))
if err != nil {
return fmt.Errorf("cannot read config file: %w", err)
}
@ -93,7 +92,7 @@ func write(path string, data interface{}) error {
return fmt.Errorf("cannot generate config content: %w", err)
}
err = ioutil.WriteFile(path, content, 0o600)
err = os.WriteFile(path, content, 0o600)
if err != nil {
return fmt.Errorf("cannot write config file '%s': %w", path, err)
}