stop using ioutil
This commit is contained in:
+2
-3
@@ -16,7 +16,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
@@ -38,7 +37,7 @@ func Init(dataPath string) error {
|
||||
fi, err := f.Stat()
|
||||
if err == nil && fi.Size() > 0 {
|
||||
// File is not empty
|
||||
jsonBytes, err := ioutil.ReadAll(f)
|
||||
jsonBytes, err := io.ReadAll(f)
|
||||
f.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("read comitium.json error: %w", err)
|
||||
@@ -73,7 +72,7 @@ func (d *FullData) WriteJSON(dataPath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(path, jsonBytes, 0666)
|
||||
err = os.WriteFile(path, jsonBytes, 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user