I attempted to use the new conversion of slice to array in Go, but I get a very confusing error message:
func TestName(t *testing.T) {
a := [100]int{}
b := a[10:50]
_ = b
fmt.Println(runtime.Version())
c := (*[100]int)(b)
}
sh-3.2$ go test
#
./....go: cannot convert b (type []int) to type *[100]int:
conversion of slices to array pointers only supported as of -lang=go1.17
Which is confusing me because go version
reports 1.17.6.
Why is it complaining about something that is supposedly introduced in the version it is using?
Is -lang=go1.17
supposed to be a flag I can/must pass? it doesn't seem to do anything if I try it.
Edit: I now realise it would have panicked anyway, but that's not really the point of the question.