Hacker News new | ask | show | jobs
by abdusco 1305 days ago
> pointers

Stick with pass-by-value and non-pointer receivers. Use pointers only if you have to.

2 comments

I worked with one team who deliberately chose pointer receivers for everything. Their reasoning? The compiler can't know if the receiver for the call you are making will be nil at run time, so it doesn't complain.

Yes, they literally chose to subject themselves to runtime panics to silence the compiler.

here’s a good rationale about when to use pointers: https://stackoverflow.com/a/23551970/255463