Subject: [PATCH 35/47] gnu: Add go-go-mongodb-org-mongo-driver.

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

* gnu/packages/golang.scm (go-go-mongodb-org-mongo-driver): New
variable.
---
 gnu/packages/golang.scm | 67 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index e71f70520d..cf53f50fd9 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -10585,6 +10585,73 @@ (define-public go-github-com-youmark-pkcs8
     (home-page "https://github.com/youmark/pkcs8")
     (license license:expat)))
 
+(define-public go-go-mongodb-org-mongo-driver
+  (package
+    (name "go-go-mongodb-org-mongo-driver")
+    (version "1.8.4")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mongodb/mongo-go-driver")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "12lkr8p84x8n9yl1pa7gnl1hjvjr1azz3jms9cvfngq8kl8dy3ic"))))
+    (build-system go-build-system)
+    (arguments
+     '(#:unpack-path "go.mongodb.org/mongo-driver"
+       #:phases
+       (let ((paths '("go.mongodb.org/mongo-driver/bson"
+                      "go.mongodb.org/mongo-driver/event"
+                      "go.mongodb.org/mongo-driver/mongo"
+                      "go.mongodb.org/mongo-driver/tag"
+                      "go.mongodb.org/mongo-driver/x/bsonx"
+                      "go.mongodb.org/mongo-driver/x/mongo/driver")))
+         (modify-phases %standard-phases
+           (replace 'build
+             (lambda args
+               (for-each (lambda (path)
+                           (apply (assoc-ref %standard-phases
+                                             'build)
+                                  `(,@args #:import-path
+                                    ,path))) paths)))
+           (replace 'check
+             (lambda args
+               (for-each (lambda (path)
+                           (apply (assoc-ref %standard-phases
+                                             'check)
+                                  `(,@args #:import-path
+                                    ,path)))
+                         ;; `mongo' tests require a running mongodb
+                         (delete "go.mongodb.org/mongo-driver/mongo" paths))))
+           (replace 'install
+             (lambda args
+               (for-each (lambda (path)
+                           (apply (assoc-ref %standard-phases
+                                             'install)
+                                  `(,@args #:import-path
+                                    ,path))) paths)))))))
+    (propagated-inputs (list go-github-com-go-stack-stack
+                             go-github-com-golang-snappy
+                             go-github-com-klauspost-compress
+                             go-github-com-kr-pretty
+                             go-github-com-montanaflynn-stats
+                             go-github-com-pkg-errors
+                             go-github-com-tidwall-pretty
+                             go-github-com-xdg-go-scram
+                             go-github-com-xdg-go-stringprep
+                             go-github-com-youmark-pkcs8
+                             go-golang-org-x-crypto
+                             go-golang-org-x-sync
+                             go-golang-org-x-tools))
+    (native-inputs (list go-github-com-google-go-cmp-cmp
+                         go-github-com-stretchr-testify))
+    (synopsis "Go driver for MongoDB")
+    (description "Go driver for MongoDB.")
+    (home-page "https://github.com/mongodb/mongo-go-driver")
+    (license license:asl2.0)))
+
 (define-public go-google-golang-org-protobuf
   (package
     (name "go-google-golang-org-protobuf")
-- 
2.34.0