Skip to content

Commit

Permalink
fix bug about not support more operations on string (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
studyzy committed Aug 28, 2023
1 parent 9ea1afc commit d840a14
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
goconst
7 changes: 6 additions & 1 deletion tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ func testCase() string {
case "moo":
return ""
}
return "foo"

test2 := "moo" + fmt.Sprintf("%d", testInt())
if test2 > "foo" {
test2 += "foo"
}
return "foo" + test2
}

func testInt() int {
Expand Down
4 changes: 0 additions & 4 deletions visitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ func (v *treeVisitor) Visit(node ast.Node) ast.Visitor {

// if foo == "moo"
case *ast.BinaryExpr:
if t.Op != token.EQL && t.Op != token.NEQ {
return v
}

var lit *ast.BasicLit
var ok bool

Expand Down

0 comments on commit d840a14

Please sign in to comment.