1
0
mirror of https://github.com/TomWright/dasel.git synced 2022-05-22 02:32:45 +03:00

fix: convert time.Time to toml representation properly

This commit is contained in:
egawata
2022-03-30 23:29:23 +09:00
parent 46fe0a8568
commit 98123f6fa2

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"github.com/pelletier/go-toml"
"time"
)
func init() {
@@ -66,6 +67,8 @@ func (p *TOMLParser) ToBytes(value interface{}, options ...ReadWriteOption) ([]b
}
}
}
case time.Time:
buf.Write([]byte(fmt.Sprintf("%s\n", d.Format(time.RFC3339))))
default:
if err := enc.Encode(d); err != nil {
if err.Error() == "Only a struct or map can be marshaled to TOML" {