Subject: [PATCH 4/4] gnu: Add go-buf.

From: Jørgen Kvalsvik <[email-masked]>
Date: Fri, 15 Nov 2024 22:11:06 +0100

* gnu/packages/golang-xyz.scm (go-buf): New variable.

Change-Id: I2ff7ee23bcf5413ad3b4b4b9cbfc8a007b0b9b80
---
 gnu/packages/golang-xyz.scm | 63 ++++++++++++++++++++++++++++---------
 1 file changed, 49 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm
index 0d6debcac4..0d8147e484 100644
--- a/gnu/packages/golang-xyz.scm
+++ b/gnu/packages/golang-xyz.scm
@@ -68,6 +68,7 @@ (define-module (gnu packages golang-xyz)
   #:use-module (guix build-system copy)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
+  #:use-module (guix go-mod-download)
   #:use-module (guix packages)
   #:use-module (guix utils)
   #:use-module (gnu packages)
@@ -7591,31 +7592,65 @@ (define-public glua
       #:import-path "github.com/yuin/gopher-lua/cmd/glua"
       #:unpack-path "github.com/yuin/gopher-lua"))))
 
+(define-public go-buf
+  (package
+    (name "go-buf")
+    (version "1.46.0")
+    (source
+     (origin
+       (method go-mod-fetch)
+       (uri (go-mod-reference
+             (go go-1.23)
+             (source
+              (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/bufbuild/buf")
+                      (commit (string-append "v" version))))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "049rp4f2i759xmws6pqrw3208x1v0zdcmi3ymjbxmaq4hijl9daw"))))))
+       (sha256
+        (base32 "1sk2jhazaa1y2y5m1nmd753s0gr52c8967xr6j9pf2d675fzi7q0"))))
+    (arguments
+     (list
+      #:go go-1.23
+      #:import-path "cmd/buf"))
+    (build-system go-mod-build-system)
+    (home-page "https://github.com/bufbuild/buf")
+    (synopsis "Buf")
+    (description
+     "The @@url{https://buf.build,(code buf)} CLI is the best tool for working with
+@@url{https://protobuf.dev,Protocol Buffers}.  It provides:.")
+    (license license:asl2.0)))
+
 (define-public go-chroma
   (package
     (name "go-chroma")
     (version "2.14.0")
     (source
      (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/alecthomas/chroma")
-             (commit (string-append "v" version))))
-       (file-name (git-file-name name version))
+       (method go-mod-fetch)
+       (uri (go-mod-reference
+             (source
+              (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/alecthomas/chroma")
+                      (commit (string-append "v" version))))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1qgr4gywjks869sc85wb8nby612b8wvsa1dwpsbanjsljq7wq7mp"))))))
        (sha256
         (base32
-         "1qgr4gywjks869sc85wb8nby612b8wvsa1dwpsbanjsljq7wq7mp"))))
-    (build-system go-build-system)
+         "1xq2v3qr71mbjm328a6snqvba83nq70z6qqjfgh5mp25bwkwy6bl"))))
+    (build-system go-mod-build-system)
     (arguments
      (list
       #:install-source? #f
-      #:import-path "github.com/alecthomas/chroma/cmd/chroma"))
-    (native-inputs
-     (list go-github-com-alecthomas-assert-v2
-           go-github-com-alecthomas-chroma-v2
-           go-github-com-alecthomas-kong
-           go-github-com-mattn-go-colorable
-           go-github-com-mattn-go-isatty))
+      #:import-path "cmd/chroma"))
     (home-page "https://github.com/alecthomas/chroma")
     (synopsis "General purpose syntax highlighter in pure Golang")
     (description
-- 
2.39.5