mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 20:36:12 +02:00
lint: error handling cleanup (#1877)
This commit is contained in:
parent
66543493b5
commit
104f5d1fe6
43 changed files with 102 additions and 110 deletions
|
@ -85,18 +85,18 @@ func writeToKafka(w *kafka.Writer, logs []string) {
|
|||
func createTopic(topic string, broker string) {
|
||||
conn, err := kafka.Dial("tcp", broker)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
controller, err := conn.Controller()
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
var controllerConn *kafka.Conn
|
||||
controllerConn, err = kafka.Dial("tcp", net.JoinHostPort(controller.Host, strconv.Itoa(controller.Port)))
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
defer controllerConn.Close()
|
||||
|
||||
|
@ -110,7 +110,7 @@ func createTopic(topic string, broker string) {
|
|||
|
||||
err = controllerConn.CreateTopics(topicConfigs...)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue