Remove usages of io.ReadFile and os.WriteFile to be compatible with 1.15
This commit is contained in:
+3
-3
@@ -15,7 +15,7 @@ package core
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
@@ -37,7 +37,7 @@ func Init(dataPath string) error {
|
||||
fi, err := f.Stat()
|
||||
if err == nil && fi.Size() > 0 {
|
||||
// File is not empty
|
||||
jsonBytes, err := io.ReadAll(f)
|
||||
jsonBytes, err := ioutil.ReadAll(f)
|
||||
f.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("read comitium.json error: %w", err)
|
||||
@@ -72,7 +72,7 @@ func (d *FullData) WriteJSON(dataPath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.WriteFile(path, jsonBytes, 0666)
|
||||
err = ioutil.WriteFile(path, jsonBytes, 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+3
-2
@@ -12,6 +12,7 @@ package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
@@ -116,7 +117,7 @@ Watching these pages for any changes that occur.
|
||||
=> https://git.nytpu.com/comitium/about/ aggregated using comitium
|
||||
`
|
||||
|
||||
err := os.WriteFile(path, []byte(rawPage), 0666)
|
||||
err := ioutil.WriteFile(path, []byte(rawPage), 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -161,7 +162,7 @@ func (d *FullData) WriteFeed(dataPath string) error {
|
||||
=> https://git.nytpu.com/comitium/about/ aggregated using comitium
|
||||
`
|
||||
|
||||
err := os.WriteFile(path, []byte(rawPage), 0666)
|
||||
err := ioutil.WriteFile(path, []byte(rawPage), 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user