fix some bug and standardize the code (#2)

This commit is contained in:
Li4n0
2021-04-22 16:40:22 +08:00
committed by GitHub
parent 960b2ab5ea
commit 72c6150517
10 changed files with 45 additions and 55 deletions
+3 -4
View File
@@ -1,7 +1,6 @@
package cli
import (
"io/ioutil"
"os"
"sort"
@@ -35,12 +34,12 @@ func Start() {
},
Action: func(c *cli.Context) error {
conf := &server.Config{}
if content, err := ioutil.ReadFile("config.yaml"); err == nil {
if content, err := os.ReadFile("config.yaml"); err == nil {
if err := yaml.Unmarshal(content, conf); err != nil {
log.Fatal(err.Error())
return err
}
} else {
log.Fatal(err.Error())
return err
}
if c.String("addr") != "" {
conf.Addr = c.String("addr")