mirror of
https://github.com/hashicorp/packer.git
synced 2026-02-24 10:21:20 -05:00
* upgrade linodego to v0.14.0 * fix builder/linode linter errors * Update go.mod Co-authored-by: Adrien Delorme <adrien.delorme@icloud.com>
22 lines
301 B
Go
22 lines
301 B
Go
package parseabletime
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
dateLayout = "2006-01-02T15:04:05"
|
|
)
|
|
|
|
type ParseableTime time.Time
|
|
|
|
func (p *ParseableTime) UnmarshalJSON(b []byte) error {
|
|
t, err := time.Parse(`"`+dateLayout+`"`, string(b))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*p = ParseableTime(t)
|
|
|
|
return nil
|
|
}
|