Golang Slice of struct VS slice of Pointers to struct
1 min readSep 18, 2020
A little bit confused about the difference between the slice of struct and slice of pointers to a struct. In this article, I’d like to try to make this problem clear.
There is a nice discussion in [1] and the problem is clearly defined in [1], however, the solution is not satisfied. Another discussion can be found in [2].
A nice discussion can be found in [3] and the answer is “It depends”.
Reference
[1] Slices of structs vs. slices of pointers to structs
[2]https://medium.com/@philpearl/bad-go-slices-of-pointers-ed3c06b8bb41