Update pkg/yqlib/encoder_toml.go

Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
This commit is contained in:
Mike Farah 2025-12-20 15:07:00 +11:00 committed by GitHub
parent b8d90fd574
commit 4d620bfa26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,10 +34,9 @@ func (te *tomlEncoder) Encode(writer io.Writer, node *CandidateNode) error {
// Encode to a buffer first if colors are enabled
var buf bytes.Buffer
var targetWriter io.Writer
targetWriter = writer
if te.prefs.ColorsEnabled {
targetWriter = &buf
} else {
targetWriter = writer
}
// Encode a root mapping as a sequence of attributes, tables, and arrays of tables