context passing

This commit is contained in:
Ilia Denisov
2026-03-12 19:46:59 +02:00
parent 079b9facb0
commit f985370089
5 changed files with 23 additions and 11 deletions
+7 -1
View File
@@ -1,11 +1,13 @@
package main
import (
"context"
"errors"
"fmt"
"galaxy/client"
mc "galaxy/model/client"
"os"
"os/signal"
"fyne.io/fyne/v2/app"
)
@@ -27,7 +29,11 @@ func main() {
settings := mc.Settings{
StoragePath: ".",
}
c, err := client.NewClient(nil, app, settings)
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()
c, err := client.NewClient(ctx, nil, app, settings)
if err != nil {
return
}