Skip to content

Commit d840a14

Browse files
authored
fix bug about not support more operations on string (#21)
1 parent 9ea1afc commit d840a14

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
goconst

tests/main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ func testCase() string {
2727
case "moo":
2828
return ""
2929
}
30-
return "foo"
30+
31+
test2 := "moo" + fmt.Sprintf("%d", testInt())
32+
if test2 > "foo" {
33+
test2 += "foo"
34+
}
35+
return "foo" + test2
3136
}
3237

3338
func testInt() int {

visitor.go

-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ func (v *treeVisitor) Visit(node ast.Node) ast.Visitor {
6262

6363
// if foo == "moo"
6464
case *ast.BinaryExpr:
65-
if t.Op != token.EQL && t.Op != token.NEQ {
66-
return v
67-
}
68-
6965
var lit *ast.BasicLit
7066
var ok bool
7167

0 commit comments

Comments
 (0)