Subject: [bug#68617] [PATCH] gnu: Add go-github-com-gabriel-vasile-mimetype.

From: "Artyom V. Poptsov" <[email-masked]>
Date: Sun, 04 Feb 2024 20:14:43 +0300

Hello,

I attached the old version of the patch by mistake to the previous
email.

Here's the right version.
From c6cc2c6c04019a10717bc19c80a4d4f18013e793 Mon Sep 17 00:00:00 2001
Message-ID: <c6cc2c[email-masked]>
From: "Artyom V. Poptsov" <[email-masked]>
Date: Sat, 20 Jan 2024 21:07:27 +0300
Subject: [PATCH] gnu: Add go-github-com-gabriel-vasile-mimetype.

* gnu/packages/golang.scm (go-github-com-gabriel-vasile-mimetype): New
  variable.

Change-Id: Icb1624eb9a890b6f711dacf5ff80f15b041f3b7d
---
 gnu/packages/golang.scm | 51 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 014ca01602..ab92cec4e4 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -4112,6 +4112,57 @@ (define-public go-github-com-technoweenie-multipartstreamer
 without reading the entire content into memory.")
     (license license:expat)))
 
+(define-public go-github-com-gabriel-vasile-mimetype
+  (package
+    (name "go-github-com-gabriel-vasile-mimetype")
+    (version "1.4.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/gabriel-vasile/mimetype")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "11swnjczhrza0xi8q2wlk056nnbcghm44vqs52zfv6rwqvy6imhj"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:go go-1.20
+      #:import-path "github.com/gabriel-vasile/mimetype"
+      #:phases #~(modify-phases %standard-phases
+                   (add-before 'check 'add-supported-mimes-md
+                     (lambda* (#:key import-path #:allow-other-keys)
+                       ;; This file needs to be available for writing during the
+                       ;; tests otherwise they will fail.
+                       (let ((file (format #f "src/~a/supported_mimes.md"
+                                           import-path)))
+                         (invoke "touch" file)
+                         (chmod file #o644)))))))
+    (propagated-inputs (list go-golang-org-x-net))
+    (home-page "https://github.com/gabriel-vasile/mimetype")
+    (synopsis "Golang library for media type and file extension detection")
+    (description
+     "A Golang package that uses magic number signatures to detect the MIME type of a
+file.
+
+Main features:
+@itemize
+@item Fast and precise MIME type and file extension detection.
+@item Supports
+@url{https://github.com/gabriel-vasile/mimetype/blob/master/supported_mimes.md,
+many MIME types}.
+@item Allows to
+@url{https://pkg.go.dev/github.com/gabriel-vasile/mimetype#example-package-Extend,
+extend} with other file formats.
+@item Common file formats are prioritized.
+@item
+@url{https://pkg.go.dev/github.com/gabriel-vasile/mimetype#example-package-TextVsBinary,
+Differentiation between text and binary files}.
+@item Safe for concurrent usage.
+@end itemize")
+    (license license:expat)))
+
 (define-public go-github-com-tevino-abool
   (let ((commit
           "3c25f2fe7cd0ef3eabefce1d90efd69a65d35b12")

base-commit: abeffc82379c4f9bd2e6226ea27453b22cb4e0c8
-- 
2.41.0

Thanks,
- avp

-- 
Artyom "avp" Poptsov <[email-masked]>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F