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

Decode NUMBER into float32 and float64 fields #210

Merged
merged 1 commit into from
Sep 14, 2017

Conversation

magiconair
Copy link
Contributor

The decoder does not allow to decode a NUMBER into a float32/float64 field.

func TestDecodeFloat(t *testing.T) {
	type X struct {
		A float64
	}

	var x X
	if err := hcl.Decode(&x, "a=2"); err != nil {
		t.Fatal(err)
	}
}

fails with

--- FAIL: TestDecodeFloat (0.00s)
	main_test.go:19: At 1:3: root.A: unknown type *ast.LiteralType

This patch decodes a NUMBER value (e.g. "2") into a float32 and float64
field.
@mitchellh mitchellh merged commit 68e816d into master Sep 14, 2017
@mitchellh mitchellh deleted the decode-number-into-float branch September 14, 2017 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants