mirror of
https://github.com/golang/go
synced 2024-11-18 21:24:44 -07:00
7da5f193b7
This CL introduces two vet checks. Statistics and code below are from a recent 50mb corpus of public code. 1. Check for redundant conjunctions and disjunctions. This check caught 26 instances, of which 20 were clearly copy/paste bugs and 6 appeared to be mere duplication. A typical example: if xResolution < 0 || xResolution < 0 { panic("SetSize(): width < 0 || height < 0") } 2. Check for expressions of the form 'x != c1 || x != c2' or 'x == c1 && x == c2', with c1 and c2 constant expressions. This check caught 16 instances, of which all were bugs. A typical example: if rf.uri.Scheme != "http" || rf.uri.Scheme != "ftp" { rf.uri.Scheme = "file" } Fixes golang/go#7622. LGTM=rsc, r R=golang-codereviews, jscrockett01, r, gri, rsc CC=golang-codereviews https://golang.org/cl/98120043 |
||
---|---|---|
.. | ||
asm1.s | ||
asm2.s | ||
asm3.s | ||
asm4.s | ||
asm.go | ||
assign.go | ||
atomic.go | ||
bool.go | ||
buildtag_bad.go | ||
buildtag.go | ||
composite.go | ||
copylock.go | ||
deadcode.go | ||
method.go | ||
nilfunc.go | ||
print.go | ||
rangeloop.go | ||
shadow.go | ||
structtag.go | ||
unsafeptr.go |