#re-slicing
7 messages · Page 1 of 1 (latest)
b[:2] check that
if cap(b) < 2 {
panicindex(2, cap(b))
}
it creates new length by taking it from the capacity
cap(b) > 2 right?
no this is happy left code.
if the check passes we panic
I cant understand why your code explain b has length 2 you mean it takes length from capacity when resliced?
when reslicing the length is not checked, only capacity is, because you have a capacity of 5, you can set the length to 2 because 2 is smaller than 5