←back to thread

Go is still not good

(blog.habets.se)
644 points ustad | 1 comments | | HN request time: 0.218s | source
Show context
softwaredoug ◴[] No.44983216[source]
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.

replies(7): >>44983251 #>>44983254 #>>44983637 #>>44985983 #>>44986255 #>>44986985 #>>45002523 #
1. looshch ◴[] No.45002523[source]
> my main annoyance is deciding when to use a pointer or not use a pointer as variable/receiver/argument

i think you can take these[1][2][3][4] official advices and extrapolate to other cases

[1] https://go.dev/wiki/CodeReviewComments#receiver-type

[2] https://google.github.io/styleguide/go/decisions#receiver-ty...

[3] https://go.dev/doc/effective_go#pointers_vs_values

[4] https://go.dev/doc/faq#methods_on_values_or_pointers