Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

support result.Int() int not int64 #306

Open
yingjie52 opened this issue Jan 5, 2023 · 2 comments
Open

support result.Int() int not int64 #306

yingjie52 opened this issue Jan 5, 2023 · 2 comments

Comments

@yingjie52
Copy link

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

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

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

@rentiansheng
Copy link

rentiansheng commented Jan 6, 2023

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)
	}
}

@zuozhehao
Copy link

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants