The Debug console of VS Code is displaying a large slice/array like this:
canvas.img.Pix
[]uint8 len: 2073600, cap: 2073600, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...+2073536 more]
How can you figure out which canvas.img.Pix
elements are non-zero?
0
You could just iterate over the slice and break
on the first non-zero value you get. This break
statement could in-turn be used to set-up a breakpoint:
v := []byte{0, 0, 0, 0, 0, 0, 0, 1}
for _, vv := range v {
if vv > 0 {
// use a break statement to set a breakpoint
break
}
}
2