You can slice a slice:
nums := []int{1, 2, 3, 4, 5}
sub := nums[1:4]
subsub := sub[1:2]
fmt.Println(subsub) // [3]
Reslicing creates a new slice header but shares the underlying array. Changes through any slice affect the shared data.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Reslicing
You can slice a slice:
nums := []int{1, 2, 3, 4, 5}
sub := nums[1:4]
subsub := sub[1:2]
fmt.Println(subsub) // [3]
Reslicing creates a new slice header but shares the underlying array. Changes through any slice affect the shared data.