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: incorrect detection of self-assignment #22174

klauspost opened this issue Oct 7, 2017 · 2 comments

cmd/vet: incorrect detection of self-assignment #22174

klauspost opened this issue Oct 7, 2017 · 2 comments


Copy link

@klauspost klauspost commented Oct 7, 2017

What version of Go are you using (go version)?

>go version
go version go1.9.1 windows/amd64

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=d:\dev\gopath\
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=e:\temp\wintemp\go-build563293679=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_CFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config

What did you do?

Save to main.go
Execute go vet main.go

What did you expect to see?

Nothing. The code is not self-assigning.

What did you see instead?

main.go:11: self-assignment of s[rng.Intn(len(s))] to s[rng.Intn(len(s))]
exit status 1
@ianlancetaylor ianlancetaylor changed the title cmd/vet: Wrong detection of self-assignment cmd/vet: incorrect detection of self-assignment Oct 7, 2017
@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Oct 7, 2017

This comment has been minimized.

Copy link

@mvdan mvdan commented Oct 8, 2017

I'll take a stab at this later.

@mvdan mvdan self-assigned this Oct 8, 2017

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Oct 8, 2017

Change mentions this issue: cmd/vet: skip self-assigns that contain any calls

@gopherbot gopherbot closed this in 320b0cd Oct 9, 2017
@golang golang locked and limited conversation to collaborators Oct 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.