From cb7c9d700b4026388c1ed8643d2569fa59ba3ae8 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sun, 2 Jul 2023 14:08:26 -0400 Subject: [PATCH] go vet claims we need a buffered chan for signal --- admin.go | 2 +- util.go | 6 +++--- web.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/admin.go b/admin.go index ad24e5d..5115971 100644 --- a/admin.go +++ b/admin.go @@ -125,7 +125,7 @@ func adminscreen() { } defer restore() go func() { - sig := make(chan os.Signal) + sig := make(chan os.Signal, 1) signal.Notify(sig, os.Interrupt) <-sig restore() diff --git a/util.go b/util.go index 6919296..f709513 100644 --- a/util.go +++ b/util.go @@ -90,7 +90,7 @@ func initdb() { os.Remove(dbname) os.Exit(1) }() - c := make(chan os.Signal) + c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) go func() { <-c @@ -209,7 +209,7 @@ func adduser() { defer func() { os.Exit(1) }() - c := make(chan os.Signal) + c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) go func() { <-c @@ -263,7 +263,7 @@ func chpass(username string) { defer func() { os.Exit(1) }() - c := make(chan os.Signal) + c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) go func() { <-c diff --git a/web.go b/web.go index 11d1876..0cf5364 100644 --- a/web.go +++ b/web.go @@ -2567,7 +2567,7 @@ var readyalready = make(chan bool) var workinprogress = 0 func enditall() { - sig := make(chan os.Signal) + sig := make(chan os.Signal, 1) signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) <-sig ilog.Printf("stopping...")