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: vet's heuristic for lock detection has unreasonable false positives #26165

Closed
kortschak opened this issue Jun 30, 2018 · 2 comments
Closed

Comments

@kortschak
Copy link
Contributor

@kortschak kortschak commented Jun 30, 2018

What version of Go are you using (go version)?

go version go1.10.3 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOHOSTOS="linux"

What did you do?

Run go vet on the code at https://play.golang.org/p/gKSNBMyRunJ

package fauxlock

type fl struct{}

func (l *fl) Lock() error { return nil }

type w struct{ fl }

func wrap(l *fl) w { return w{*l} }

What did you expect to see?

No output since *fl does not implement sync.Locker.

What did you see instead?

$ go vet
# _/home/.../lock-vet
./lock.go:9: literal copies lock value from *l: fauxlock.fl
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 1, 2018

Change https://golang.org/cl/121876 mentions this issue: cmd/vet,sync: check lock values more precisely

@andybons

This comment has been minimized.

Copy link
Member

@andybons andybons commented Jul 2, 2018

@andybons andybons added this to the Unplanned milestone Jul 2, 2018
@gopherbot gopherbot closed this in c2eba53 Jul 14, 2018
@golang golang locked and limited conversation to collaborators Jul 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.