In Go, what is the difference between var s []int and s := make([]int, 0)?
var s []int
s := make([]int, 0)
I find that both works, but which one is better?
Just found a difference. If you use
var list []MyObjects
and then you encode the output as JSON, you get null.
null
list := make([]MyObjects, 0)
results in [] as expected.
[]