fix: remove deprecated calls to ioutil
This commit is contained in:
parent
26d78be263
commit
75918ffdb7
1 changed files with 2 additions and 3 deletions
|
@ -6,7 +6,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
@ -74,7 +73,7 @@ type Updater interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
func read(path string, data interface{}) error {
|
func read(path string, data interface{}) error {
|
||||||
content, err := ioutil.ReadFile(filepath.Clean(path))
|
content, err := os.ReadFile(filepath.Clean(path))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot read config file: %w", err)
|
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)
|
return fmt.Errorf("cannot generate config content: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(path, content, 0o600)
|
err = os.WriteFile(path, content, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot write config file '%s': %w", path, err)
|
return fmt.Errorf("cannot write config file '%s': %w", path, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue