chore: remove refs to deprecated io/ioutil (#309)
Signed-off-by: guoguangwu <guoguangwug@gmail.com> Co-authored-by: James Read <contact@jread.com>
This commit is contained in:
parent
9d33e62d34
commit
7e34efd453
|
|
@ -9,7 +9,6 @@ import (
|
|||
sv "github.com/OliveTin/OliveTin/internal/stringvariables"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gopkg.in/yaml.v3"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
|
@ -57,7 +56,7 @@ func loadEntityFileJson(filename string, entityname string) {
|
|||
"name": entityname,
|
||||
}).Infof("Loading entity file with JSON format")
|
||||
|
||||
jfile, err := ioutil.ReadFile(filename)
|
||||
jfile, err := os.ReadFile(filename)
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("ReadIn: %v", err)
|
||||
|
|
@ -90,7 +89,7 @@ func loadEntityFileYaml(filename string, entityname string) {
|
|||
"name": entityname,
|
||||
}).Infof("Loading entity file with YAML format")
|
||||
|
||||
yfile, err := ioutil.ReadFile(filename)
|
||||
yfile, err := os.ReadFile(filename)
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("ReadIn: %v", err)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
|
|
@ -495,7 +494,7 @@ func saveLogResults(req *ExecutionRequest, filename string) {
|
|||
}
|
||||
|
||||
filepath := path.Join(dir, filename+".yaml")
|
||||
err = ioutil.WriteFile(filepath, data, 0644)
|
||||
err = os.WriteFile(filepath, data, 0644)
|
||||
|
||||
if err != nil {
|
||||
log.Warnf("%v", err)
|
||||
|
|
@ -509,7 +508,7 @@ func saveLogOutput(req *ExecutionRequest, filename string) {
|
|||
if dir != "" {
|
||||
data := req.logEntry.Stdout + "\n" + req.logEntry.Stderr
|
||||
filepath := path.Join(dir, filename+".log")
|
||||
err := ioutil.WriteFile(filepath, []byte(data), 0644)
|
||||
err := os.WriteFile(filepath, []byte(data), 0644)
|
||||
|
||||
if err != nil {
|
||||
log.Warnf("%v", err)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"encoding/json"
|
||||
// cors "github.com/OliveTin/OliveTin/internal/cors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
|
@ -89,7 +88,7 @@ func generateThemeCss(w http.ResponseWriter, r *http.Request) {
|
|||
customThemeCssRead = true
|
||||
|
||||
if _, err := os.Stat(themeCssFilename); err == nil {
|
||||
customThemeCss, err = ioutil.ReadFile(themeCssFilename)
|
||||
customThemeCss, err = os.ReadFile(themeCssFilename)
|
||||
} else {
|
||||
log.Debugf("Theme CSS not read: %v", err)
|
||||
customThemeCss = []byte("/* not found */")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/OliveTin/OliveTin/internal/filehelper"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gopkg.in/yaml.v3"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ func parseCalendarFile(action *config.Action, cfg *config.Config, ex *executor.E
|
|||
"filename": filename,
|
||||
}).Infof("Parsing calendar file")
|
||||
|
||||
yfile, err := ioutil.ReadFile(action.ExecOnCalendarFile)
|
||||
yfile, err := os.ReadFile(action.ExecOnCalendarFile)
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("ReadIn: %v", err)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/google/uuid"
|
||||
"github.com/robfig/cron/v3"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
|
@ -30,7 +30,7 @@ var CurrentVersion = "?"
|
|||
|
||||
func installationID(filename string) string {
|
||||
var content string
|
||||
contentBytes, err := ioutil.ReadFile(filename)
|
||||
contentBytes, err := os.ReadFile(filename)
|
||||
|
||||
if err != nil {
|
||||
fileHandle, err := os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0644)
|
||||
|
|
@ -113,7 +113,7 @@ func doRequest(jsonUpdateRequest []byte) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
newVersion, _ := ioutil.ReadAll(resp.Body)
|
||||
newVersion, _ := io.ReadAll(resp.Body)
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue