golang/go

x/tour: minor confusion of array and slice length

Open

#79419 opened on May 15, 2026

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Go (133,883 stars) (19,008 forks)batch import
DocumentationFixPendinghelp wanted

Description

The page about automatic slice ends at https://go.dev/tour/moretypes/10 reads (emphasis mine):

The default is zero for the low bound and the length of the slice for the high bound.

This is a bit confusing because up to that point, slices have always been generated from arrays, not slices. My first thought was "oh, you mean the length of the array for the high bound", which is indeed conformant to the example in the text. But in the code example on the right, slicing from a slice is introduced, so the full meaning is probably something along the lines of "length of the underlying array or slice".

As the result of slicing is also a slice, the term "length of the slice" could further be mistaken (in confusion) to mean the length of the resulting slice (however that might work), that's why I'd suggest adding the word "underlying".

Contributor guide