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