I would like to create a function that returns a slice of any size. I know what I can do
func BuildSlice() [100]int { return [100]int{} }
but I would like to be able to return fragments of different sizes from the same function. Sort of:
func BuildSlice(int size) [...]int { return [size]int{} }
I tried above as well
func BuildSlice(size int) []int { return [size]int{} }
Please point me in the right direction.
Thank.
source
share