We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version go1.24.0 linux/amd64
go env
AR='ar' CC='gcc' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_ENABLED='1' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' CXX='g++' GCCGO='gccgo' GO111MODULE='' GOAMD64='v1' GOARCH='amd64' GOAUTH='netrc' GOBIN='' GOCACHE='/home/mneverov/.cache/go-build' GOCACHEPROG='' GODEBUG='' GOENV='/home/mneverov/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFIPS140='off' GOFLAGS='' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/home/mneverov/tmp/go-build1453477970=/tmp/go-build -gno-record-gcc-switches' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMOD='/home/mneverov/go/src/github.com/mneverov/test/go.mod' GOMODCACHE='/home/mneverov/go/pkg/mod' GOOS='linux' GOPATH='/home/mneverov/go' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTELEMETRY='on' GOTELEMETRYDIR='/home/mneverov/.config/go/telemetry' GOTMPDIR='/home/mneverov/tmp' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.24.0' GOWORK='' PKG_CONFIG='pkg-config'
func main() { s := make([]sync.Mutex, 1, 1) s[0] = sync.Mutex{} var s1 []sync.Mutex for range 1 { s1 = append(s, sync.Mutex{}) } s[0].Lock() s1[0].Lock() fmt.Println("not ok") }
link.
go vet does not complain about copying the slice during append. Same when a map grows.
go vet
go vet does not complain about mutexes being copied
call of append copies lock value: sync.Mutex
The text was updated successfully, but these errors were encountered:
This can't be accurate accurate enough for vet: it's safe to use if the capacity is enough for append without growing the backing array.
Sorry, something went wrong.
Related Issues
Related Code Changes
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
No branches or pull requests
Go version
go version go1.24.0 linux/amd64
Output of
go env
in your module/workspace:What did you do?
link.
go vet
does not complain about copying the slice during append. Same when a map grows.What did you see happen?
go vet does not complain about mutexes being copied
What did you expect to see?
call of append copies lock value: sync.Mutex
The text was updated successfully, but these errors were encountered: