[go-nuts] Re: how to create array of structures instances for the nested structures

2021-07-14 Thread jake...@gmail.com
Some ways to do it: https://play.golang.org/p/sg08Buv-E3- Note that arrays are rarely used in Go. When in doubt, default to using a slice. I provided slice examples as well. If you want to initialize a very large array or slice to a value other than the zero value, you could also use a loop.

[go-nuts] Re: how to create array of structures instances for the nested structures

2021-07-14 Thread Brian Candler
https://play.golang.org/p/YtxPYZ4H-Sy In practice, you'll usually find you want to create a slice, not an array. Arrays have a fixed size. On Wednesday, 14 July 2021 at 16:32:13 UTC+1 trivedi...@gmail.com wrote: > Hi all, it would be helpful for me if a small doubt of mine is resolved. > > I w