util: Don't assume Go is installed on Windows.

This is a workaround for golang/go#21881.
This commit is contained in:
Go Tasty 2018-05-14 23:40:36 -07:00
parent 9e3a080aa3
commit 3edc0afa89

View file

@ -2,7 +2,11 @@
package util package util
import "time" import (
"time"
"4d63.com/tz"
)
// Eastern returns the eastern timezone. // Eastern returns the eastern timezone.
func (d date) Eastern() *time.Location { func (d date) Eastern() *time.Location {
@ -10,7 +14,11 @@ func (d date) Eastern() *time.Location {
_easternLock.Lock() _easternLock.Lock()
defer _easternLock.Unlock() defer _easternLock.Unlock()
if _eastern == nil { if _eastern == nil {
_eastern, _ = time.LoadLocation("EST") var err error
_eastern, err = tz.LoadLocation("EST")
if err != nil {
panic(err)
}
} }
} }
return _eastern return _eastern