1
0
Fork 0

WARN: -> [WARN]. ioutil.WriteFile changed to modern os.WriteFile.

This commit is contained in:
Alexander Andreev 2022-10-10 00:08:30 +04:00
parent c56ef45ed1
commit 7c4c378508
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F
1 changed files with 3 additions and 5 deletions

View File

@ -2,7 +2,6 @@ package main
import (
"bufio"
"io/ioutil"
"log"
"os"
"strconv"
@ -37,14 +36,14 @@ func LoadConfiguration(path string) (conf *Configuration, err error) {
case "indented_output":
v, err := strconv.ParseBool(kv[1])
if err != nil {
log.Printf("WARN: could not parse \"indented_output\", valid values are true or false. Defaulted to false.\n")
log.Printf("[WARN] could not parse \"indented_output\", valid values are true or false. Defaulted to false.\n")
}
conf.IndentedOutput = v
case "processes":
if kv[1] != "" {
conf.Processes = append(conf.Processes, strings.Split(kv[1], " ")...)
} else {
log.Printf("WARN: \"processes\" list is empty.\n")
log.Printf("[WARN] \"processes\" list is empty.\n")
}
}
}
@ -64,8 +63,7 @@ func (conf *Configuration) StoreConfiguration(path string) (err error) {
config.WriteByte('\n')
config.WriteString("processes = ")
config.WriteString(strings.Join(conf.Processes, " "))
if err := ioutil.WriteFile(path, []byte(config.String()), 0644); err != nil {
if err := os.WriteFile(path, []byte(config.String()), 0644); err != nil {
return err
}