74 lines
2.0 KiB
Diff
74 lines
2.0 KiB
Diff
diff --git a/src/time/internal_test.go b/src/time/internal_test.go
|
|
index f0dddb7..415949a 100644
|
|
--- a/src/time/internal_test.go
|
|
+++ b/src/time/internal_test.go
|
|
@@ -4,13 +4,15 @@
|
|
|
|
package time
|
|
|
|
+import "runtime"
|
|
+
|
|
func init() {
|
|
// force US/Pacific for time zone tests
|
|
ForceUSPacificForTesting()
|
|
}
|
|
|
|
func initTestingZone() {
|
|
- z, err := loadLocation("America/Los_Angeles", zoneSources[len(zoneSources)-1:])
|
|
+ z, err := loadLocation("America/Los_Angeles", zoneSources)
|
|
if err != nil {
|
|
panic("cannot load America/Los_Angeles for testing: " + err.Error() + "; you may want to use -tags=timetzdata")
|
|
}
|
|
@@ -21,8 +23,9 @@ func initTestingZone() {
|
|
var OrigZoneSources = zoneSources
|
|
|
|
func forceZipFileForTesting(zipOnly bool) {
|
|
- zoneSources = make([]string, len(OrigZoneSources))
|
|
+ zoneSources = make([]string, len(OrigZoneSources)+1)
|
|
copy(zoneSources, OrigZoneSources)
|
|
+ zoneSources = append(zoneSources, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
|
|
if zipOnly {
|
|
zoneSources = zoneSources[len(zoneSources)-1:]
|
|
}
|
|
diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go
|
|
index f032aa7..e3e5547 100644
|
|
--- a/src/time/zoneinfo_test.go
|
|
+++ b/src/time/zoneinfo_test.go
|
|
@@ -9,6 +9,7 @@ import (
|
|
"fmt"
|
|
"os"
|
|
"reflect"
|
|
+ "runtime"
|
|
"testing"
|
|
"time"
|
|
)
|
|
@@ -137,7 +138,7 @@ func TestLoadLocationFromTZData(t *testing.T) {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
- tzinfo, err := time.LoadTzinfo(locationName, time.OrigZoneSources[len(time.OrigZoneSources)-1])
|
|
+ tzinfo, err := time.LoadTzinfo(locationName, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
|
|
index 23f8b3c..228db1b 100644
|
|
--- a/src/time/zoneinfo_unix.go
|
|
+++ b/src/time/zoneinfo_unix.go
|
|
@@ -12,7 +12,6 @@
|
|
package time
|
|
|
|
import (
|
|
- "runtime"
|
|
"syscall"
|
|
)
|
|
|
|
@@ -22,7 +21,6 @@ var zoneSources = []string{
|
|
"/usr/share/zoneinfo/",
|
|
"/usr/share/lib/zoneinfo/",
|
|
"/usr/lib/locale/TZ/",
|
|
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
|
|
}
|
|
|
|
func initLocal() {
|