batch icon indicating copy to clipboard operation
batch copied to clipboard

Indexing bug in batchItems slicing

Open IsmailAfiff opened this issue 3 years ago • 3 comments

In the tutorial, the usage of the function is batchItems := items[start:end]. Golang slice is exclusive meaning the end is not included in the slice, therefore it should be batchItems := items[start:end+1].

IsmailAfiff avatar May 06 '21 16:05 IsmailAfiff

You mean :end+1] ?

adityathebe avatar May 14 '21 12:05 adityathebe

Yap you're right it should be :end+1

IsmailAfiff avatar May 17 '21 11:05 IsmailAfiff

Any plans to either update the blog post or fix the issue here directly.

I of course understand that it's a breaking change and so probably not ideal, despite my shared thinking that [start:end] is the correct and assumed treatment regardless of what the blog post says, others may disagree. So, updating the post seems worthwhile to IMHO.

RyanBalfanz avatar Oct 22 '21 00:10 RyanBalfanz