This commit is contained in:
shoopea 2020-01-16 21:33:34 +08:00
parent 937a2b61ae
commit a9d402831e

View File

@ -12,19 +12,19 @@ import (
"github.com/jinzhu/copier" "github.com/jinzhu/copier"
) )
func loadClients() { func loadClients() error {
var clts []ChirpClient var clts []ChirpClient
b, err := ioutil.ReadFile("./clients.json") b, err := ioutil.ReadFile("./clients.json")
logOnError(err, "loadClients : ReadFile(./clients.json)") logOnError(err, "loadClients : ReadFile(./clients.json)")
if err != nil { if err != nil {
return return err
} }
err = json.Unmarshal(b, &clts) err = json.Unmarshal(b, &clts)
logOnError(err, "loadClients : Unmarshal(./clients.json)") logOnError(err, "loadClients : Unmarshal(./clients.json)")
if err != nil { if err != nil {
return return err
} }
muxClients.Lock() muxClients.Lock()
@ -37,7 +37,7 @@ func loadClients() {
} }
muxClients.Unlock() muxClients.Unlock()
return return nil
} }