zlacker

[return to "Go is still not good"]
1. softwa+Hb[view] [source] 2025-08-22 11:31:25
>>ustad+(OP)
I like Go, but my main annoyance is deciding when to use a pointer or not use a pointer as variable/receiver/argument. And if its an interface variable, it has a pointer to the concrete instance in the interface 'struct'. Some things are canonically passed as pointers like contexts.

It just feels sloppy and I'm worried I'm going to make a mistake.

◧◩
2. spicyu+ui[view] [source] 2025-08-22 12:21:49
>>softwa+Hb
...do you want a copy or the original object?
◧◩◪
3. tgv+Kn[view] [source] 2025-08-22 12:49:01
>>spicyu+ui
Yup, that's it. If you're going to modify a field in the receiver, or want to pass a field by reference, you're going to need a pointer. Otherwise, a value will do, unless ... that weird interface thing makes you. I guess that's the problem?
[go to top]