Skip to content

cmd/vet: vet's heuristic for lock detection has unreasonable false positives #26165

Closed
@kortschak

Description

@kortschak

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions