From 3de26ac69875f8f238fc18517d53b41c777dd854 Mon Sep 17 00:00:00 2001 From: snoop Date: Mon, 17 Apr 2017 11:11:47 +0900 Subject: [PATCH] fixed wrong import erros package GetClient --- crawler_manager.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/crawler_manager.go b/crawler_manager.go index 101cedd..3114a11 100644 --- a/crawler_manager.go +++ b/crawler_manager.go @@ -11,8 +11,9 @@ import ( "os" "log" - "github.com/kataras/go-errors" + "path/filepath" + "errors" ) const ( @@ -44,27 +45,25 @@ func init() { //g_CrawlerMananger.init() } -func GetInstance() *CrawlerManager { - return g_CrawlerMananger; -} +func GetClient(container string) (*grpc.ClientConn, error) { + crm := GetInstance() + b := crm.checkContainer(&container) -func (c *CrawlerManager)GetClient(container string,port string) (*grpc.ClientConn, error) { - - b := c.checkContainer(&container) if b == false { - //c.runContainer(&container) - //CallInit() - err := c.runAndInitContainer(&container) + err := crm.runAndInitContainer(&container) if err != nil { return nil, err } } - - gport := c.portMap[container] + gport := crm.portMap[container] return grpc.Dial(address+gport, grpc.WithInsecure()) } +func GetInstance() *CrawlerManager { + return g_CrawlerMananger; +} + func readConfig(path string ) *config.Config {