package elastic import ( "context" "fmt" "log" ) // close the client func (c *Client) Teardown(ctx context.Context) error { log.Println(">>>> elastic.Teardown()") defer log.Println("<<<< elastic.Teardown()") if c == nil || c.ch == nil { return fmt.Errorf("error source not opened for reading") } close(c.shutdown) c.wg.Wait() close(c.ch) c.ch = nil // c.es.Close() return nil }