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
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@kortschak
Copy link
Contributor

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
Copy link

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

@andybons
Copy link
Member

andybons commented Jul 2, 2018

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 2, 2018
@andybons andybons added this to the Unplanned milestone Jul 2, 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.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants