So when we write the Widget and its Foo method, we can either choose to make a nil Widget meaningful and check a nil receiver in Foo, or make nil invalid and assume the caller has checked nil or otherwise knows the value is non-nil before calling Foo?
Comments
There’s no reason for it to be nil unless someone has explicitly made it nil.
w := &Widget{}
type Widget struct {
gg *geegaw
}
where geegaw is some unexported type. You want the zero-value of Widget to be usable, so the nil value of geegaw should be valid, but you keep that internal to your package.