]> Cypherpunks repositories - gostls13.git/commit
cmd/vet: detect misuse of atomic.Add*
authorRodrigo Rafael Monti Kochenburger <divoxx@gmail.com>
Wed, 30 Jan 2013 15:57:11 +0000 (07:57 -0800)
committerRuss Cox <rsc@golang.org>
Wed, 30 Jan 2013 15:57:11 +0000 (07:57 -0800)
commit607317651206f32ee11bf97ec0fe8c473bba403d
treece486d83e27dc558d2da98feeaaa69f14e66c7ab
parent660c4cde9ce10ff158fc76bf8f75c9d0e880d346
cmd/vet: detect misuse of atomic.Add*

Re-assigning the return value of an atomic operation to the same variable being operated is a common mistake:

x = atomic.AddUint64(&x, 1)

Add this check to go vet.

Fixes #4065.

R=dvyukov, golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7097048
src/cmd/vet/Makefile
src/cmd/vet/atomic.go [new file with mode: 0644]
src/cmd/vet/main.go