gjson icon indicating copy to clipboard operation
gjson copied to clipboard

support result.Int() int not int64

Open yingjie52 opened this issue 2 years ago • 2 comments

conc := gjson.Get(json, "test1.concurrency").Int()

for i := 0; i < conc; i++ 

raise error: 无效运算: i < conc(类型 int 和 int64 不匹配)

yingjie52 avatar Jan 05 '23 07:01 yingjie52

you can

conc := gjson.Get(json, "test1.concurrency").Int()
for idx := int64(0); idx < cnt; idx++ {
		fmt.Println(idx)
}
package main

import "fmt"

func main() {
	cnt := int64(10)
	for idx := int64(0); idx < cnt; idx++ {
		fmt.Println(idx)
	}
}

rentiansheng avatar Jan 06 '23 02:01 rentiansheng

var i int64
for i = 0; i < conc; i++ 

zuozhehao avatar Jan 10 '23 08:01 zuozhehao