]> git.pld-linux.org Git - packages/golang.git/blame - 0001-Don-t-use-the-bundled-tzdata-at-runtime-except-for-t.patch
up to 1.10.3
[packages/golang.git] / 0001-Don-t-use-the-bundled-tzdata-at-runtime-except-for-t.patch
CommitLineData
2a683cca
JP
1From edce31a2904846ae74e3c011f2cf5fddc963459e Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
3Date: Thu, 22 Mar 2018 12:07:32 +0100
4Subject: [PATCH 1/3] Don't use the bundled tzdata at runtime, except for the
5 internal test suite
6
7---
8 src/time/internal_test.go | 7 +++++--
9 src/time/zoneinfo_test.go | 3 ++-
10 src/time/zoneinfo_unix.go | 2 --
11 3 files changed, 7 insertions(+), 5 deletions(-)
12
13diff --git a/src/time/internal_test.go b/src/time/internal_test.go
14index 76d5524124..e81ace5f64 100644
15--- a/src/time/internal_test.go
16+++ b/src/time/internal_test.go
17@@ -4,13 +4,15 @@
18
19 package time
20
21+import "runtime"
22+
23 func init() {
24 // force US/Pacific for time zone tests
25 ForceUSPacificForTesting()
26 }
27
28 func initTestingZone() {
29- z, err := loadLocation("America/Los_Angeles", zoneSources[len(zoneSources)-1:])
30+ z, err := loadLocation("America/Los_Angeles", zoneSources)
31 if err != nil {
32 panic("cannot load America/Los_Angeles for testing: " + err.Error())
33 }
34@@ -21,8 +23,9 @@ func initTestingZone() {
35 var OrigZoneSources = zoneSources
36
37 func forceZipFileForTesting(zipOnly bool) {
38- zoneSources = make([]string, len(OrigZoneSources))
39+ zoneSources = make([]string, len(OrigZoneSources)+1)
40 copy(zoneSources, OrigZoneSources)
41+ zoneSources = append(zoneSources, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
42 if zipOnly {
43 zoneSources = zoneSources[len(zoneSources)-1:]
44 }
45diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go
46index 7a55d4f618..6063ca1195 100644
47--- a/src/time/zoneinfo_test.go
48+++ b/src/time/zoneinfo_test.go
49@@ -8,6 +8,7 @@ import (
50 "fmt"
51 "os"
52 "reflect"
53+ "runtime"
54 "testing"
55 "time"
56 )
57@@ -128,7 +129,7 @@ func TestLoadLocationFromTZData(t *testing.T) {
58 t.Fatal(err)
59 }
60
61- tzinfo, err := time.LoadTzinfo(locationName, time.OrigZoneSources[len(time.OrigZoneSources)-1])
62+ tzinfo, err := time.LoadTzinfo(locationName, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
63 if err != nil {
64 t.Fatal(err)
65 }
66diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
67index 88313aa0ed..d9596115ef 100644
68--- a/src/time/zoneinfo_unix.go
69+++ b/src/time/zoneinfo_unix.go
70@@ -12,7 +12,6 @@
71 package time
72
73 import (
74- "runtime"
75 "syscall"
76 )
77
78@@ -22,7 +21,6 @@ var zoneSources = []string{
79 "/usr/share/zoneinfo/",
80 "/usr/share/lib/zoneinfo/",
81 "/usr/lib/locale/TZ/",
82- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
83 }
84
85 func initLocal() {
86--
872.14.3
88
This page took 0.066915 seconds and 4 git commands to generate.