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

TreeFromMap Fails for Array of string #356

Closed
jixiuf opened this issue Apr 15, 2020 · 1 comment
Closed

TreeFromMap Fails for Array of string #356

jixiuf opened this issue Apr 15, 2020 · 1 comment
Labels
bug Issues describing a bug in go-toml.

Comments

@jixiuf
Copy link
Contributor

jixiuf commented Apr 15, 2020

Describe the bug
got this error

    TestTreeFromMapArray: config_test.go:24: shound not err (0, 0): Can't convert [foo bar]([]string) to []string(slice)

To Reproduce

type testStruct struct {
	Slice []string `  toml:"alice"  `
}

func TestTreeFromMapArray(t *testing.T) {
	tree, _ := toml.Load(`alice = ["foo","bar"]`)
	tree, _ = toml.TreeFromMap(tree.ToMap())

	var result testStruct
	err := tree.Unmarshal(&result)
	if err != nil {
		t.Error("shound not err", err)
	}

}

Expected behavior
should not error.

Versions

  • go-toml: v1.7.0 (8e8d2a6)
  • go: version: go1.14.2
  • operating system: macOS
@pelletier pelletier added the bug Issues describing a bug in go-toml. label Apr 15, 2020
@pelletier
Copy link
Owner

Definitely looks wrong. Thank you for the bug report!

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