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

Panic when parsing '0' using parseFloat #886

Closed
ocean2811 opened this issue Aug 21, 2023 · 0 comments
Closed

Panic when parsing '0' using parseFloat #886

ocean2811 opened this issue Aug 21, 2023 · 0 comments
Labels
bug Issues describing a bug in go-toml.

Comments

@ocean2811
Copy link
Contributor

Describe the bug
Panic when parsing '0'(number without decimals) as a float type.

To Reproduce

const file = `foo = 0` // read from .toml file

type Toml struct {
    Foo float64 `toml:"foo"`
}

t := &Toml{}
err := toml.Unmarshal([]byte(file), t)
fmt.Println(t, err)
return

Expected behavior
Normal output of TOML structure contents.

Versions

  • go-toml: v2.0.9 (e183db7)
  • go: version 1.20.4
  • operating system: Windows, Linux
ocean2811 added a commit to ocean2811/go-toml that referenced this issue Aug 21, 2023
@pelletier pelletier added the bug Issues describing a bug in go-toml. label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues describing a bug in go-toml.
Projects
None yet
Development

No branches or pull requests

2 participants