3 ms·
Why would you have a method that doesn’t touch the receiver? Refactor it into a function.
by Cyph0n 4y ago
Why would you have a method that doesn’t touch the receiver? Refactor it into a function.
- assbuttbuttass 4y agoDereferencing isn't the only way to touch a pointer: func (o *myObject) isNil() bool { return o == nil }
- Cyph0n 4y agoRight, but if you’re doing a nil check, you obviously won’t be worried about nil deferences.
- remexre 4y agoEither to implement an interface, or because it branches to check if the value is nil before dereferencing it
- Cyph0n 4y agoRe: the second point, see my other comment.