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: new(sync.Once) copies lock value: sync.Once contains sync.Mutex #14994

Closed
mholt opened this issue Mar 28, 2016 · 2 comments
Closed

cmd/vet: new(sync.Once) copies lock value: sync.Once contains sync.Mutex #14994

mholt opened this issue Mar 28, 2016 · 2 comments
Milestone

Comments

@mholt
Copy link

mholt commented Mar 28, 2016

  1. What version of Go are you using (go version)?
    go version devel +ad391c9 Sat Mar 26 12:12:04 2016 +0000 linux/amd64
  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/travis/gopath"
    GORACE=""
    GOROOT="/home/travis/.gimme/versions/go"
    GOTOOLDIR="/home/travis/.gimme/versions/go/pkg/tool/linux_amd64"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build398857422=/tmp/go-build"
    CXX="g++"
    CGO_ENABLED="0"
  3. What did you do?
    Ran CI tests on Go tip. Tests now fail on code that hasn't changed recently and still passes on Go 1.6. For example: https://travis-ci.org/mholt/caddy/builds/118687079
  4. What did you expect to see?
    No errors
  5. What did you see instead?
$ go vet ./...
caddy/config.go:194: function call copies lock value: sync.Once contains sync.Mutex
caddy/config_test.go:114: function call copies lock value: sync.Once contains sync.Mutex
caddy/config_test.go:115: function call copies lock value: sync.Once contains sync.Mutex

Relevant lines of code are:

onces[dir.name] = new(sync.Once)
map[string]*sync.Once{
    "dummy":  new(sync.Once),
    "dummy2": new(sync.Once),
}

Is new() really a function call that is copying a lock value?

@valyala
Copy link
Contributor

valyala commented Mar 28, 2016

Should be fixed by the CL https://golang.org/cl/21222

@gopherbot
Copy link

CL https://golang.org/cl/21222 mentions this issue.

@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Jul 20, 2016
@golang golang locked and limited conversation to collaborators Jul 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants