Subject: [PATCH 2/3] gnu: Go: Do not depend on tzdata.

From: Leo Famulari <[email-masked]>
Date: Fri, 21 Apr 2023 17:01:01 -0400

* gnu/packages/golang.scm (go-1.4)[inputs]: Remove tzdata.
[arguments]: Adjust accordingly.
(go-1.14, go-1.16, go-1.17)[arguments]: Adjust accordingly.
---
 gnu/packages/golang.scm | 27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 24dae34e20..73c70f55fb 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -139,8 +139,6 @@ (define-public go-1.4
                     (ld (string-append (assoc-ref inputs "libc") "/lib"))
                     (loader (car (find-files ld "^ld-linux.+")))
                     (net-base (assoc-ref inputs "net-base"))
-                    (tzdata-path
-                     (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))
                     (output (assoc-ref outputs "out")))
 
                ;; Removing net/ tests, which fail when attempting to access
@@ -195,8 +193,6 @@ (define-public go-1.4
 
                (substitute* "net/lookup_unix.go"
                  (("/etc/protocols") (string-append net-base "/etc/protocols")))
-               (substitute* "time/zoneinfo_unix.go"
-                 (("/usr/share/zoneinfo/") tzdata-path))
                (substitute* (find-files "cmd" "asm.c")
                  (("/lib/ld-linux.*\\.so\\.[0-9]") loader))
                #t)))
@@ -238,8 +234,7 @@ (define-public go-1.4
                (copy-recursively "../" output)
                #t))))))
     (inputs
-     `(("tzdata" ,tzdata)
-       ("pcre" ,pcre)
+     `(("pcre" ,pcre)
        ("gcc:lib" ,(canonical-package gcc) "lib")))
     (native-inputs
      (list pkg-config which net-base perl))
@@ -285,8 +280,6 @@ (define-public go-1.14
                       (loader (car (append (find-files ld "^ld-linux.+")
                                            (find-files ld "^ld(64)?\\.so.+"))))
                       (net-base (assoc-ref inputs "net-base"))
-                      (tzdata-path
-                       (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))
                       (output (assoc-ref outputs "out")))
 
                  ;; Having the patch in the 'patches' field of <origin> breaks
@@ -400,8 +393,6 @@ (define-public go-1.14
                    (("/etc/protocols") (string-append net-base "/etc/protocols")))
                  (substitute* "net/port_unix.go"
                    (("/etc/services") (string-append net-base "/etc/services")))
-                 (substitute* "time/zoneinfo_unix.go"
-                   (("/usr/share/zoneinfo/") tzdata-path))
                  (substitute* (find-files "cmd" "\\.go")
                    (("/lib(64)?/ld-linux.*\\.so\\.[0-9]") loader))
                  #t)))
@@ -497,9 +488,7 @@ (define-public go-1.16
            (replace 'prebuild
              (lambda* (#:key inputs outputs #:allow-other-keys)
                (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib"))
-                      (net-base (assoc-ref inputs "net-base"))
-                      (tzdata-path
-                       (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
+                      (net-base (assoc-ref inputs "net-base")))
 
                  ;; Having the patch in the 'patches' field of <origin> breaks
                  ;; the 'TestServeContent' test due to the fact that
@@ -591,9 +580,7 @@ (define-public go-1.16
                  (substitute* "net/lookup_unix.go"
                    (("/etc/protocols") (string-append net-base "/etc/protocols")))
                  (substitute* "net/port_unix.go"
-                   (("/etc/services") (string-append net-base "/etc/services")))
-                 (substitute* "time/zoneinfo_unix.go"
-                   (("/usr/share/zoneinfo/") tzdata-path)))))
+                   (("/etc/services") (string-append net-base "/etc/services"))))))
            (replace 'build
              (lambda* (#:key inputs outputs (parallel-build? #t)
                        #:allow-other-keys)
@@ -665,9 +652,7 @@ (define-public go-1.17
                (setenv "GOCACHE" "/tmp/go-cache"))))
          (add-after 'unpack 'patch-source
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((net-base (assoc-ref inputs "net-base"))
-                    (tzdata-path (string-append (assoc-ref inputs "tzdata")
-                                                "/share/zoneinfo")))
+             (let* ((net-base (assoc-ref inputs "net-base")))
                ;; XXX: Remove when #49729 is merged?
                (for-each make-file-writable (find-files "src"))
 
@@ -696,9 +681,7 @@ (define-public go-1.17
                   (string-append net-base "/etc/protocols")))
                (substitute* "src/net/port_unix.go"
                  (("/etc/services")
-                  (string-append net-base "/etc/services")))
-               (substitute* "src/time/zoneinfo_unix.go"
-                 (("/usr/share/zoneinfo/") tzdata-path)))))
+                  (string-append net-base "/etc/services"))))))
          ;; Keep this synchronized with the package inputs.
          ;; Also keep syncthonized with later versions of go.
          ,@(if (or (target-arm?) (target-ppc64le?))
-- 
2.39.2