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

support parsing uint64 #608

Merged
merged 1 commit into from Sep 27, 2021
Merged

Conversation

xwjdsh
Copy link

@xwjdsh xwjdsh commented Sep 26, 2021

Issue: add link to pelletier/go-toml issue here
spf13/viper#1221

Explanation of what this pull request does.

For the following code snippet, an error will be returned, (2, 5): strconv.ParseInt: parsing "18446744073709551615": value out of range, this PR deals with cases where the value is greater than math.MaxInt64 and less than or equal to math.MaxUint64.

package main

import (
	"fmt"

	"github.com/pelletier/go-toml"
)

type Config struct {
	V uint64
}

func main() {
	doc := []byte(`
V = 18446744073709551615
`)

@pelletier pelletier added the v2-fixed This bug is present in v1 and has been solved in v2 label Sep 27, 2021
@pelletier pelletier merged commit c42c336 into pelletier:master Sep 27, 2021
17 checks passed
@pelletier
Copy link
Owner

pelletier commented Sep 27, 2021

Thank you for the patch!

Not sure what version of go-toml Viper uses, but if possible I recommend using go-toml/v2, where that bug was not present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2-fixed This bug is present in v1 and has been solved in v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants