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:
@@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/pelletier/go-toml"
|
"github.com/pelletier/go-toml"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
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:
|
default:
|
||||||
if err := enc.Encode(d); err != nil {
|
if err := enc.Encode(d); err != nil {
|
||||||
if err.Error() == "Only a struct or map can be marshaled to TOML" {
|
if err.Error() == "Only a struct or map can be marshaled to TOML" {
|
||||||
|
|||||||
Reference in New Issue
Block a user