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

Comments

Projects
None yet
3 participants
@kortschak
Copy link
Contributor

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

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

commented Jul 2, 2018

@andybons andybons added this to the Unplanned milestone Jul 2, 2018

@gopherbot gopherbot closed this in c2eba53 Jul 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.