Skip to content

Commit

Permalink
fix: fix conversion from int to float64 (#753)
Browse files Browse the repository at this point in the history
* fix: fix conversion from int to float64

* fix: fix a compile error

```
cannot convert v (variable of type interface{}) to type float64: need type assertion
```
  • Loading branch information
suzuki-shunsuke authored Jun 9, 2024
1 parent c8d95b9 commit 4324105
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,16 @@ func jsonToValue(i *interpreter, v interface{}) (value, error) {

case bool:
return makeValueBoolean(v), nil
case int, int8, int16, int32, int64:
return makeDoubleCheck(i, v.(float64))
case int:
return makeDoubleCheck(i, float64(v))
case int8:
return makeDoubleCheck(i, float64(v))
case int16:
return makeDoubleCheck(i, float64(v))
case int32:
return makeDoubleCheck(i, float64(v))
case int64:
return makeDoubleCheck(i, float64(v))
case float64:
return makeDoubleCheck(i, v)

Expand Down

0 comments on commit 4324105

Please sign in to comment.