print newline when panicking

This commit is contained in:
Balakrishnan Balasubramanian 2023-03-21 14:24:53 -04:00
parent bb9a12ef13
commit 4e54219efb

View File

@ -45,7 +45,7 @@ func main() {
} }
if err := os.MkdirAll(dataPath, 0755); err != nil { if err := os.MkdirAll(dataPath, 0755); err != nil {
log.Panicf("Failed to create datapath, path: %s, err: %s", dataPath, err) log.Panicf("Failed to create datapath, path: %s, err: %s\n", dataPath, err)
} }
return dataPath return dataPath
}() }()
@ -67,7 +67,7 @@ func main() {
var chats sync.Map var chats sync.Map
if err := loadData(dataPath, &chats); err != nil { if err := loadData(dataPath, &chats); err != nil {
log.Panicf("failed to load data, err: %s", err) log.Panicf("failed to load data, err: %s\n", err)
} }
botPath := fmt.Sprintf("/bot%s", apiToken) botPath := fmt.Sprintf("/bot%s", apiToken)
http.HandleFunc(botPath, func(w http.ResponseWriter, r *http.Request) { http.HandleFunc(botPath, func(w http.ResponseWriter, r *http.Request) {
@ -131,7 +131,7 @@ func main() {
} }
}) })
log.Panic(http.ListenAndServe(fmt.Sprintf(":%v", port), nil)) log.Panicln(http.ListenAndServe(fmt.Sprintf(":%v", port), nil))
} }
func handleTextAdded(gl *glist.GList, text string) { func handleTextAdded(gl *glist.GList, text string) {