Might worth noting:
Use :=
when you need to create a variable with a defined value on it.
number := 12
obj := SomeStruct{name: "user"}
slice := []string{"a", "b", "c"}
Use var
keyword when you need to define a variable without any initialisation, so the zero value will be used on it.
var a int // the default value will be the zero value of int, which is 0
var mut sync.Mutex
var result []map[string]interface{}
Also there is another advantage of using var
keyword, like we can create multiple variable with one type in one line.
var result1, result2, result3, result4 []map[string]interface{}