decode: fix wrong indention for tables' comments (#892)

This commit is contained in:
Mikhail f. Shiryaev
2023-08-28 19:23:11 +02:00
committed by GitHub
parent 76cc96f6d8
commit 4a5c27c299
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -1208,7 +1208,7 @@ func TestMarhsalIssue888(t *testing.T) {
}
type Cfg struct {
Custom []Thing
Custom []Thing `comment:"custom config"`
}
buf := new(bytes.Buffer)
@@ -1223,7 +1223,8 @@ func TestMarhsalIssue888(t *testing.T) {
encoder := toml.NewEncoder(buf).SetIndentTables(true)
encoder.Encode(config)
expected := `[[Custom]]
expected := `# custom config
[[Custom]]
# my field A
FieldA = 'field a 1'
# my field B