diff --git a/test/main.go b/test/main.go index 28a3ee37b1..af9ffe5c30 100644 --- a/test/main.go +++ b/test/main.go @@ -22,6 +22,7 @@ import ( "os" "os/signal" "path/filepath" + "runtime" "syscall" "time" @@ -42,13 +43,23 @@ func main() { log.Println("version =", version) - // Exercise timezone conversions, which demonstrates tzdata is provided - // by the base image. - now := time.Now() - loc, _ := time.LoadLocation("UTC") - fmt.Printf("UTC Time: %s\n", now.In(loc)) - loc, _ = time.LoadLocation("America/New_York") - fmt.Printf("New York Time: %s\n", now.In(loc)) + if runtime.GOOS == "windows" { + // Go seems to not load location data from Windows, so timezone + // conversion fails unless tzdata is embedded in the Go program + // with the go build tag `timetzdata`. Since we want to test + // loading tzdata provided by the base image below, we'll just + // skip that for Windows here. + // See https://github.com/google/ko/issues/739 + log.Println("skipping timezone conversion on Windows") + } else { + // Exercise timezone conversions, which demonstrates tzdata is provided + // by the base image. + now := time.Now() + loc, _ := time.LoadLocation("UTC") + fmt.Printf("UTC Time: %s\n", now.In(loc)) + loc, _ = time.LoadLocation("America/New_York") + fmt.Printf("New York Time: %s\n", now.In(loc)) + } dp := os.Getenv("KO_DATA_PATH") file := filepath.Join(dp, *f)