Skip to content

Commit

Permalink
record enc.inTable statu
Browse files Browse the repository at this point in the history
Signed-off-by: he1pa <18012015693@163.com>
  • Loading branch information
He1pa committed Jan 6, 2025
1 parent f32088d commit 8c75530
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/3rdparty/toml/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ func (enc *Encoder) eArrayOfTables(key Key, rv reflect.Value) {
}

func (enc *Encoder) eTable(key Key, rv reflect.Value) {
inTable := enc.inTable
enc.inTable = true
if len(key) == 1 {
// Output an extra newline between top-level tables.
Expand All @@ -406,7 +407,7 @@ func (enc *Encoder) eTable(key Key, rv reflect.Value) {
enc.newline()
}
enc.eMapOrStruct(key, rv, false)
enc.inTable = false
enc.inTable = inTable
}

func (enc *Encoder) eMapOrStruct(key Key, rv reflect.Value, inline bool) {
Expand Down
2 changes: 2 additions & 0 deletions pkg/tools/gen/gentoml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ c_key = "value3"
if err != nil && tt.expectErr != nil {
if err.Error() != tt.expectErr.Error() {
t.Fatalf("expected error: %v, got: %v", tt.expectErr, err)
} else {
return
}
}

Expand Down

0 comments on commit 8c75530

Please sign in to comment.