Skip to content

Commit a7b3ee4

Browse files
fix: fix false-positive (#97)
Signed-off-by: Sasha Melentyev <[email protected]>
1 parent 5149298 commit a7b3ee4

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

pkg/analyzer/analyzer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ func run(pass *analysis.Pass) (interface{}, error) {
117117

118118
case *ast.BinaryExpr:
119119
switch n.Op {
120-
case token.LSS, token.GTR, token.LEQ, token.GEQ:
120+
case token.LSS, token.GTR, token.LEQ, token.GEQ, token.QUO, token.ADD, token.SUB, token.MUL:
121121
return
122+
default:
122123
}
123124

124125
x, ok := n.X.(*ast.SelectorExpr)
@@ -138,7 +139,6 @@ func run(pass *analysis.Pass) (interface{}, error) {
138139
if ok {
139140
switchStmt(pass, x, n.Body.List)
140141
}
141-
142142
}
143143
})
144144

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package http_test
2+
3+
import (
4+
"net/http"
5+
)
6+
7+
func _() error {
8+
resp, err := http.DefaultClient.Do(&http.Request{})
9+
if err != nil {
10+
return err
11+
}
12+
defer func() { _ = resp.Body.Close() }()
13+
14+
if resp.StatusCode/100 != 2 {
15+
return nil
16+
}
17+
if resp.StatusCode+100 != 2 {
18+
return nil
19+
}
20+
if resp.StatusCode-100 != 2 {
21+
return nil
22+
}
23+
if resp.StatusCode*100 != 2 {
24+
return nil
25+
}
26+
27+
return nil
28+
}

0 commit comments

Comments
 (0)