Errata for golang faq


(Sandip Bhattacharya) #1

Is this the right place to file errors in the golang faq page?

In https://golang.org/doc/faq#methods_on_values_or_pointers

The current text reads:

First, and most important, does the method need to modify the receiver? If it does, the receiver must be a pointer. (Slices and maps act as references, so their story is a little more subtle, but for instance to change the length of a slice in a method the receiver must still be a pointer.) In the examples above, if pointerMethod modifies the fields of s, the caller will see those changes, but valueMethod is called with a copy of the caller’s argument (that’s the definition of passing a value), so changes it makes will be invisible to the caller.

There is a significant typo here which might confuse newbies like me.

The last sentence should read:

In the examples above, if pointerMethod modifies the fields of s, the caller will see those changes, but IF valueMethod is called with a copy of the caller’s argument (that’s the definition of passing a value), NO changes it makes will be invisible to the caller.


(Christoph Berger) #2

On first reading, I agreed with your conclusion, but the second time I read the sentence I noticed that the two parts of the sentence actually refer to two different variables: pointerMethod and valueMethod, so the sentence seems correct as it is.

And BTW I have no official information where to raise issues for the Go docs at golang.org, but the issue tracker contains documentation-related issues, so this might be the place for addressing issues with the FAQ.


(system) #3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.