Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

GetInt error #5

Closed
wujianqiangwjq opened this issue May 30, 2020 · 2 comments
Closed

GetInt error #5

wujianqiangwjq opened this issue May 30, 2020 · 2 comments

Comments

@wujianqiangwjq
Copy link

cat config.json
{
"host": "10.240.212.100",
"username": "root",
"password": "Password123",
"user": ["user1", "user2"],
"num": 90
}

c, _ := config.New(config.Options{Feeder: feeder.Json{Path: "config.json"}})
host, err := c.GetInt("num")
fmt.Println(err)
fmt.Println(host)
output:
value for num is not int
0

@wujianqiangwjq
Copy link
Author

this type is float64

@miladrahimi
Copy link
Member

miladrahimi commented May 30, 2020

We use native Go JSON unmarshal and it uses float64 for numeric values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants