The max array length is math.MaxInt. "[math.MaxInt]struct{}" is valid, though the practical size of non-zero-size array is hard limited in some way.
On Friday, October 28, 2022 at 9:43:16 AM UTC+8 eric...@arm.com wrote: > The spec says that " The length is part of the array's type; it must > evaluate to a non-negative constant <https://go.dev/ref/spec#Constants> > representable <https://go.dev/ref/spec#Representability> by a value of > type int. ", so on a 64-bit environment, I assume that the maximum array > length should be math.MaxInt64, am I right ? But the following code doesn't > compile: > > package main > var x = [1<<34]byte{1<<23: 23, 1<<24: 24, 1<<33:33} > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/df18462d-4ec1-4287-ad71-ef4aa0d85a5dn%40googlegroups.com.