go: x/net/context: go vet fails because of copied Mutex

  1. What version of Go are you using (go version)?
go version go1.6 linux/amd64
  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
  1. What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good. A link on play.golang.org is best.

Ran go vet ./... on a project with golang.org/x/net/context/context.go in vendor/.

Also tried running go vet on a fresh clone of https://github.com/golang/net.

  1. What did you expect to see?

go vet to exit with status 0.

  1. What did you see instead?
context.go:218: newCancelCtx returns lock by value: context.cancelCtx contains sync.Mutex
exit status 1

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Cool, thanks, does that cover new(sync.Once) too, then?

Yes