WARN: -> [WARN]. ioutil.WriteFile changed to modern os.WriteFile.
This commit is contained in:
parent
c56ef45ed1
commit
7c4c378508
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -37,14 +36,14 @@ func LoadConfiguration(path string) (conf *Configuration, err error) {
|
|||||||
case "indented_output":
|
case "indented_output":
|
||||||
v, err := strconv.ParseBool(kv[1])
|
v, err := strconv.ParseBool(kv[1])
|
||||||
if err != nil {
|
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
|
conf.IndentedOutput = v
|
||||||
case "processes":
|
case "processes":
|
||||||
if kv[1] != "" {
|
if kv[1] != "" {
|
||||||
conf.Processes = append(conf.Processes, strings.Split(kv[1], " ")...)
|
conf.Processes = append(conf.Processes, strings.Split(kv[1], " ")...)
|
||||||
} else {
|
} 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.WriteByte('\n')
|
||||||
config.WriteString("processes = ")
|
config.WriteString("processes = ")
|
||||||
config.WriteString(strings.Join(conf.Processes, " "))
|
config.WriteString(strings.Join(conf.Processes, " "))
|
||||||
|
if err := os.WriteFile(path, []byte(config.String()), 0644); err != nil {
|
||||||
if err := ioutil.WriteFile(path, []byte(config.String()), 0644); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user