There is many method defined with ptr receiver but which will fail when called with a nil. Also, many function takes a ptr to a value but doesn't handle the nil case. Even many struct contains list of non-nil pointers, ptr field which has to be defined, ...
For example, let's take Roster. NewRoster can return nil (instead of an error), but then, none of its methods will work. It contains a []*network.ServerIdentity, but all methods using it simply dereference each element. All its methods are ptr receiver but most (all maybe) doesn't mutate anything. Most methods return ptr but returning nil doesn't makes sense (or is used as an error channel).
There is many method defined with ptr receiver but which will fail when called with a nil. Also, many function takes a ptr to a value but doesn't handle the nil case. Even many struct contains list of non-nil pointers, ptr field which has to be defined, ...
For example, let's take
Roster
.NewRoster
can return nil (instead of an error), but then, none of its methods will work. It contains a[]*network.ServerIdentity
, but all methods using it simply dereference each element. All its methods are ptr receiver but most (all maybe) doesn't mutate anything. Most methods return ptr but returning nil doesn't makes sense (or is used as an error channel).