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

Closed
gopherbot opened this issue Jul 11, 2014 · 5 comments
Milestone

Comments

@gopherbot
Copy link

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.

1. http://play.golang.org/p/FMsMT0dnhf

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.
@ianlancetaylor
Copy link
Contributor

Comment 1:

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

@rsc
Copy link
Contributor

rsc commented Sep 15, 2014

Comment 2:

Status changed to Accepted.

@josharian
Copy link
Contributor

Comment 3:

Owner changed to @josharian.

Status changed to Started.

@gopherbot
Copy link
Author

Comment 5:

CL https://golang.org/cl/145360043 mentions this issue.

@josharian
Copy link
Contributor

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.
Projects
None yet
Development

No branches or pull requests

4 participants