From 22ae2f9b78dfdd2f59340d272ef598deb56cc245 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sat, 6 Jul 2024 18:06:13 +0530 Subject: go: Init() -> New(), CleanUp() -> Close() --- cmd/redq/main.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'cmd') diff --git a/cmd/redq/main.go b/cmd/redq/main.go index f368dae..288c6be 100644 --- a/cmd/redq/main.go +++ b/cmd/redq/main.go @@ -9,14 +9,14 @@ import ( "syscall" "github.com/jackc/pgx/v5" - "sinanmohd.com/redq/db" "sinanmohd.com/redq/api" + "sinanmohd.com/redq/db" "sinanmohd.com/redq/usage" ) func main() { - var u usage.Usage - var a api.Api + var u *usage.Usage + var a *api.Api iface, err := net.InterfaceByName("wlan0") if err != nil { @@ -31,11 +31,11 @@ func main() { defer conn.Close(ctx) queries := db.New(conn) - err = a.Init() + a, err = api.New() if err != nil { os.Exit(0) } - err = u.Init(iface) + u, err = usage.New(iface) if err != nil { os.Exit(0) } @@ -44,11 +44,11 @@ func main() { signal.Notify(sigs, os.Interrupt, os.Kill, syscall.SIGTERM) go func() { <-sigs - u.CleanUp(queries, ctx) - a.CleanUp() + usage.Close(u, queries, ctx) + api.Close(a) os.Exit(0) }() go u.Run(iface, queries, ctx) - a.Run(&u) + a.Run(u) } -- cgit v1.2.3