summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-06 18:06:13 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-06 18:06:17 +0530
commit22ae2f9b78dfdd2f59340d272ef598deb56cc245 (patch)
treecc7a305cb69cd915e090c63176a08b9dc247a4d2 /cmd
parentaa57cfdf36407148af613e5633e264a22c4459de (diff)
go: Init() -> New(), CleanUp() -> Close()
Diffstat (limited to 'cmd')
-rw-r--r--cmd/redq/main.go16
1 files changed, 8 insertions, 8 deletions
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)
}