Subject: [bug#54560] [PATCH 01/47] gnu: Add go-google-golang-org-protobuf.

From: Leo Nikkilä <[email-masked]>
Date: Fri, 25 Mar 2022 15:31:25 +0200

* gnu/packages/golang.scm (go-google-golang-org-protobuf): New variable.
---
 gnu/packages/golang.scm | 43 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index a8b845e301..455c4daf30 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -33,6 +33,7 @@
 ;;; Copyright © 2021 Chadwain Holness <[email-masked]>
 ;;; Copyright © 2021 Philip McGrath <[email-masked]>
 ;;; Copyright © 2021 Lu Hui <[email-masked]>
+;;; Copyright © 2022 Leo Nikkilä <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -9774,3 +9775,45 @@ (define-public go-github-com-go-chi-chi-v5
      "@code{go-github-com-go-chi-chi-v5} is an HTTP router that lets the user
 decompose request handling into many smaller layers.")
     (license license:expat)))
+
+(define-public go-google-golang-org-protobuf
+  (package
+    (name "go-google-golang-org-protobuf")
+    (version "1.27.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/protocolbuffers/protobuf-go")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0aszb7cv8fq1m8akgd4kjyg5q7g5z9fdqnry6057ygq9r8r2yif2"))))
+    (build-system go-build-system)
+    (arguments
+     '(#:import-path "google.golang.org/protobuf"
+       #:phases
+       (let ((glob-path "google.golang.org/protobuf/..."))
+         (modify-phases %standard-phases
+           (replace 'build
+             (lambda args
+               (apply (assoc-ref %standard-phases
+                                 'build)
+                      `(,@args #:import-path
+                        ,glob-path))))
+           (replace 'check
+             (lambda args
+               (apply (assoc-ref %standard-phases
+                                 'check)
+                      `(,@args #:import-path
+                        ,glob-path))))))))
+    (native-inputs (list go-github-com-google-go-cmp-cmp))
+    (synopsis "Go support for Google's protocol buffers")
+    (description
+     "Go implementation for protocol buffers, which is a
+language-neutral, platform-neutral, extensible mechanism for serializing
+structured data.  The protocol buffer language is a language for
+specifying the schema for structured data.  This schema is compiled into
+language specific bindings.")
+    (home-page "https://github.com/protocolbuffers/protobuf-go")
+    (license license:bsd-3)))
-- 
2.34.0