Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,8 @@ 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))
val, _ := v.(int64)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we need to convert the value to int64.

Is the following code wrong?

return makeDoubleCheck(i, float64(v))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

makeDoubleCheck(i, float64(v)) causes a compile error.

cannot convert v (variable of type interface{}) to type float64: need type assertion

return makeDoubleCheck(i, float64(val))
case float64:
return makeDoubleCheck(i, v)

Expand Down