Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regexp: document that Regexp values should not be copied #8794

Closed
josharian opened this issue Sep 23, 2014 · 3 comments
Closed

regexp: document that Regexp values should not be copied #8794

josharian opened this issue Sep 23, 2014 · 3 comments

Comments

@josharian
Copy link
Contributor

Regexp has an unexported sync.Mutex field. Regexps should thus not be copied, but you
cannot infer this from godoc.

Discovered while working on the vet check in issue #8356.
@josharian
Copy link
Contributor Author

Comment 1:

issue #8795 is about making godoc handle this automatically.

@rsc
Copy link
Contributor

rsc commented Sep 24, 2014

Comment 2:

This should go without saying, or it should be said somewhere else. If you use an API
that returns a *T (a pointer), you should expect that you are NOT to make copies of the
underlying data.
Doc comments should NOT be expected to say this over and over.

@josharian
Copy link
Contributor Author

Comment 3:

Good point. The two places I saw this both went out of their way to dereference the
pointer.

Status changed to Retracted.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants