From: Russ Cox x is called the
array index or map key, respectively. The following
rules apply:
For a of type A or *A
-where A is an array type (§Array types):
+where A is an array type (§Array types),
+or for a of type S where S is a slice type (§Slice types):
x must be an integer value and 0 <= x < len(a)
a[x] is the array element at index x and the type of
a[x] is the element type of A
+For a of type T
+where T is a string type (§Strings):
+
x must be an integer value and 0 <= x < len(a)
+ a[x] is the byte at index x and the type of
+ a[x] is byte
+ a[x] may not be assigned to
+
-For a of type M or *M
+For a of type M
where M is a map type (§Map types):
If the sliced operand is a string, the result of the slice operation is another, new -string (§String types). If the sliced operand is an array or slice, the result +string (§Strings). If the sliced operand is an array or slice, the result of the slice operation is a slice (§Slice types).