Subject: [bug#39317] [PATCH v2] gnu: Add go 1.13.7.

From: Jakub Kądziołka <[email-masked]>
Date: Thu, 30 Jan 2020 16:19:48 +0100

* gnu/packages/golang.scm (go-source): Factor out the source fields of
  all the go versions into a new helper function.
  (go-1.4, go-1.12)[source]: Use go-source.
  (go-1.13): New variable.
---
 gnu/packages/golang.scm | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 9102469749..2332218d29 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -63,19 +63,22 @@
 ;; gccgo-5.  Mips is not officially supported, but it should work if it is
 ;; bootstrapped.
 
+(define (go-source version hash)
+  (origin
+    (method url-fetch)
+    (uri (string-append "https://storage.googleapis.com/golang/go"
+                        version ".src.tar.gz"))
+    (sha256 (base32 hash))))
+
 (define-public go-1.4
   (package
     (name "go")
     ;; The C-language bootstrap of Go:
     ;; https://golang.org/doc/install/source#go14
     (version "1.4-bootstrap-20171003")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://storage.googleapis.com/golang/"
-                                  name version ".tar.gz"))
-              (sha256
-               (base32
-                "0liybk5z00hizsb5ypkbhqcawnwwa6mkwgvjjg4y3jm3ndg5pzzl"))))
+    (source
+      (go-source version
+        "0liybk5z00hizsb5ypkbhqcawnwwa6mkwgvjjg4y3jm3ndg5pzzl"))
     (build-system gnu-build-system)
     (outputs '("out"
                "doc"
@@ -222,13 +225,8 @@ in the style of communicating sequential processes (@dfn{CSP}).")
     (name "go")
     (version "1.12.16")
     (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://storage.googleapis.com/golang/"
-                           name version ".src.tar.gz"))
-       (sha256
-        (base32
-         "1y0x10fsvgpc1x24b9q9y6kv9b0kwf7879am3p0gym2abgc5wvnf"))))
+      (go-source version
+        "1y0x10fsvgpc1x24b9q9y6kv9b0kwf7879am3p0gym2abgc5wvnf"))
     (arguments
      (substitute-keyword-arguments (package-arguments go-1.4)
        ((#:phases phases)
@@ -367,7 +365,6 @@ in the style of communicating sequential processes (@dfn{CSP}).")
                       (docs (string-append doc_out "/share/doc/" ,name "-" ,version))
                       (src (string-append
                             (assoc-ref outputs "tests") "/share/" ,name "-" ,version)))
-                 (delete-file-recursively "../pkg/bootstrap")
                  ;; Prevent installation of the build cache, which contains
                  ;; store references to most of the tools used to build Go and
                  ;; would unnecessarily increase the size of Go's closure if it
@@ -405,6 +402,14 @@ in the style of communicating sequential processes (@dfn{CSP}).")
        ,@(package-native-inputs go-1.4)))
     (supported-systems %supported-systems)))
 
+(define-public go-1.13
+  (package
+    (inherit go-1.12)
+    (version "1.13.7")
+    (source
+      (go-source version
+        "1x21kfpzfkvmqd42pan6nl862m7jjl4niqxxpcgm46awbz645bg4"))))
+
 (define-public go go-1.12)
 
 (define-public go-github-com-alsm-ioprogress
-- 
2.25.0