Suppose I want to declare two variables outside of a function in golang, I tried to use the following code
var (
elastic *Client, err error =
elastic.NewClient(elastic.SetURL("http:145.00.000.01:9600"))
)
I got an error saying "unexpected coma, expecting semicolon, new line or ) "
Does anyone know how to fix this?
Try this way
var elastic, err = elastic.NewClient(elastic.SetURL("http:145.00.000.01:9600"))