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

cmd/vet: No warning for copying structs containing mutex by value in for-range loop #8356

gopherbot opened this issue Jul 11, 2014 · 5 comments


Copy link

@gopherbot gopherbot commented Jul 11, 2014

by nicolashillegeer:

What does 'go version' print?

go version go1.3 linux/amd64

What steps reproduce the problem?

Any program where a slice of structs (not pointes to structs) containing locking
primitives by value
is iterated over with range-for, and the locks are used in the loop body.


What happened?

Go vet didn't warn that the locking/unlocking would be rendered useless by this action.
Even though I expected it to because it also warns on returning such structs by value
from functions and the like.

What should have happened instead?

Go vet should've warned me that this was dangerous.
Copy link

@ianlancetaylor ianlancetaylor commented Jul 11, 2014

Comment 1:

Labels changed: added repo-tools, release-go1.4.

Copy link

@rsc rsc commented Sep 15, 2014

Comment 2:

Status changed to Accepted.

Copy link

@josharian josharian commented Sep 23, 2014

Comment 3:

Owner changed to @josharian.

Status changed to Started.

Copy link

@gopherbot gopherbot commented Sep 24, 2014

Comment 5:

CL mentions this issue.
Copy link

@josharian josharian commented Sep 24, 2014

Comment 6:

This issue was closed by revision golang/tools@2cd071c.

Status changed to Fixed.

@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.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants