format: improve code structure for better readability
🤖
This commit is contained in:
parent
c2310f7735
commit
912dfa62f2
2 changed files with 4 additions and 1 deletions
|
@ -11,17 +11,21 @@ import (
|
|||
|
||||
func ParseConfig(filename string) ChronoTomato.Config {
|
||||
var config ChronoTomato.Config
|
||||
|
||||
if strings.HasPrefix(filename, "~/") {
|
||||
dirname, _ := os.UserHomeDir()
|
||||
filename = filepath.Join(dirname, filename[2:])
|
||||
}
|
||||
|
||||
yamlFile, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
log.Fatal("Error opening config file!", "reason", err)
|
||||
}
|
||||
|
||||
err = yaml.Unmarshal(yamlFile, &config)
|
||||
if err != nil {
|
||||
log.Fatalf("Unmarshal: %v", err)
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
var Done = make(chan struct{})
|
||||
|
||||
func ProcessServerMessages(conn *websocket.Conn, channel chan<- GoTomato.ServerMessage) {
|
||||
|
||||
var serverMessage GoTomato.ServerMessage
|
||||
|
||||
defer close(Done)
|
||||
|
|
Loading…
Reference in a new issue