nil is not a value, it's a predeclared identifier.
it represents zero value for pointers, interfaces, maps, slices, channels and function types, representing an uninitialized value
len(nil) feels like it should work if you think of nil as the same as "value of empty array"
but what should be:
var p *Struct
len(p)
???
There's no "length of zero-valued pointer".
That’s not true. An empty slice is initialized: []T{} or make(T[]); it’s not equal to nil.[1] The zero value nil slice is technically not an “empty slice”. Colloquially you may call a nil slice an empty slice, but the nil-ness is still an important distinction that manifests in e.g. encoding/json.Marshal; nil marshals to null, whereas an initialized empty slice marshals to [].
If you want to test the emptiness of a slice, test the length, don’t compare it to nil.