Skip to content

Marshaling is wrong when a key contains a dot #398

@x-hgg-x

Description

@x-hgg-x

Describe the bug
Marshaling is wrong when a key contains a dot.

To Reproduce

type sub struct {
	Num int `toml:"c.d"`
}
type s struct {
	SubField sub `toml:"a.b"`
}

t, _ := toml.Marshal(s{sub{0}})
fmt.Println(string(t))

Output:

[a]
  [a.b]
    [a.b.c]
      d = 0

Expected behavior
Expected output:

["a.b"]
  "c.d" = 0

Versions

  • go-toml: last version of master (9ccd9bb)
  • go: 1.14
  • operating system: Linux

Additional context
None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions