I'm recently using Go to create applications. My question is this: at a certain point in the program I have a string slice:
my_slice = []string{"string1","string2","string3","string4","string5","string6"}
It contains 6 strings. Which is the best procedure (easier to write and understand) to break this slice into 3 parts, for example, and distribute the content in three sub-slices? If I have:
var my_sub_slice1 []string
var my_sub_slice2 []string
var my_sub_slice3 []string
I wish at the end of it my_sub_slice1
will contain (in his first two entries) "string1","string2"
; my_sub_slice2
will contain (in his first two entries) "string3","string4"
; my_sub_slice3
will contain (in his first two entries) "string5","string6"
.
I know the question is easy but I haven't found a clean and efficient way to do this yet.
Thanks a lot!