From 121e1470dcbde7630d6771e55323cfe118091d45 Mon Sep 17 00:00:00 2001 From: surdeus Date: Mon, 15 Jan 2024 04:01:03 +0300 Subject: [PATCH] feat: better example for the hook. --- cmd/test/main.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/cmd/test/main.go b/cmd/test/main.go index ead4c2e..2009dbd 100644 --- a/cmd/test/main.go +++ b/cmd/test/main.go @@ -10,6 +10,9 @@ import ( ) type Context = bond.Context +var ( + gclient *amo.Client +) var root = bond.Root(bond.Path(). Def( @@ -45,11 +48,6 @@ Def( )) func main() { - srv := bond.Server{ - Addr: ":15080", - Handler: root, - } - go srv.ListenAndServe() opts := &amo.Options{ Url: os.Getenv("AMO_URL"), @@ -65,13 +63,21 @@ func main() { if err != nil { panic(err) } + gclient = client if pair != nil { - fmt.Println("%q", pair) + fmt.Println("PAIR: %q", pair) } - company, err := client.GetCompany("80699047", "") + /*company, err := client.GetCompany("80699047", "") + if err != nil { + panic(err) + }*/ + srv := bond.Server{ + Addr: ":15080", + Handler: root, + } + err = srv.ListenAndServe() if err != nil { panic(err) } - fmt.Println(company) }