diff mbox series

[bug#60910,12/25] gnu: Add xurls.

Message ID 20230118014510.19320-13-cox.katherine.e@gmail.com
State New
Headers show
Series gnu: golang: Add gopls | expand

Commit Message

Katherine Cox-Buday Jan. 18, 2023, 1:44 a.m. UTC
* gnu/packages/golang.scm (xurls): New variable.
---
 gnu/packages/golang.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

\( Feb. 6, 2023, 10:32 p.m. UTC | #1
* gnu/packages/golang.scm (xurls): New variable.

> --- a/gnu/packages/golang.scm
> +++ b/gnu/packages/golang.scm

> @@ -9760,6 +9760,38 @@ (define-public go-go-uber-org-multierr

> +    (arguments
> +     `(#:import-path "mvdan.cc/xurls/v2"
> +       #:unpack-path "mvdan.cc/xurls/v2"
> +       #:phases (modify-phases %standard-phases
> +                  (replace 'build
> +                    (lambda arguments
> +                      (apply (assoc-ref %standard-phases
> +                                        'build)
> +                             `(,@arguments #:import-path
> +                               "mvdan.cc/xurls/v2/cmd/xurls")))))))

I'm not certain what you're trying to accomplish here, but would you be able
to replace this with:

  (arguments
   `(#:import-path "mvdan.cc/xurls/v2"
     #:unpack-path "mvdan.cc/xurls/v2/cmd/xurls"))

?

> +    (inputs (list go-golang-org-x-sync go-github-com-rogpeppe-go-internal))

Add newlines after the ``inputs'' symbol and between the inputs :)

> +    (description
> +     "Xurls extracts urls from plain text using regular expressions.  It can
> +be used as both a binary and a library.")

s/Xurls extracts/This package provides a Go library for extracting/

    -- (
Katherine Cox-Buday Feb. 7, 2023, 5:51 p.m. UTC | #2
"( via Guix-patches" via <guix-patches@gnu.org> writes:

> * gnu/packages/golang.scm (xurls): New variable.
>
>> --- a/gnu/packages/golang.scm
>> +++ b/gnu/packages/golang.scm
>
>> @@ -9760,6 +9760,38 @@ (define-public go-go-uber-org-multierr
>
>> +    (arguments
>> +     `(#:import-path "mvdan.cc/xurls/v2"
>> +       #:unpack-path "mvdan.cc/xurls/v2"
>> +       #:phases (modify-phases %standard-phases
>> +                  (replace 'build
>> +                    (lambda arguments
>> +                      (apply (assoc-ref %standard-phases
>> +                                        'build)
>> +                             `(,@arguments #:import-path
>> +                               "mvdan.cc/xurls/v2/cmd/xurls")))))))
>
> I'm not certain what you're trying to accomplish here, but would you be able
> to replace this with:
>
>   (arguments
>    `(#:import-path "mvdan.cc/xurls/v2"
>      #:unpack-path "mvdan.cc/xurls/v2/cmd/xurls"))
>
> ?

Hm, I'm sure I would have tried that, but I'll check and see if I can
condense this per your suggestion. Thanks!

>> +    (inputs (list go-golang-org-x-sync go-github-com-rogpeppe-go-internal))
>
> Add newlines after the ``inputs'' symbol and between the inputs :)

Why wouldn't `guix style` and `guix lint` correct this? I want to meet
the style guidelines, and I don't mean this as a contrarian statement,
but I'll never get this right unless a tool tells me it's wrong (or
ideally fixes it for me).

>> +    (description
>> +     "Xurls extracts urls from plain text using regular expressions.  It can
>> +be used as both a binary and a library.")
>
> s/Xurls extracts/This package provides a Go library for extracting/

https://guix.gnu.org/en/manual/devel/en/guix.html#Synopses-and-Descriptions:

    [Synopses] must not start with “a” or “the”, which usually does not
    bring anything; for instance, prefer “File-frobbing tool” over “A
    tool that frobs files”. The synopsis should say what the package
    is—e.g., “Core GNU utilities (file, text, shell)”—or what it is used
    for—e.g., the synopsis for GNU grep is “Print lines matching a
    pattern”.

The manual is speaking of synopses, but does it apply to descriptions
too? It seems to me like beginning the description with the name of the
binary is more correct than a self-referential "This package", which I
think meets the manual's qualifier for "does not bring anything".

Also, `Xurls` is both a library and an executable. This package is for
the executable, and a separate one was provided for the library. I think
it's probably better to keep it in the style of "$BINARY (thing that it
does)".

WDYT? These are just my opinions, and I'm open to learning! Please
include the "why" so I can have better judgment in the future.
diff mbox series

Patch

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index aa5f5ba159..cabc2a4bab 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9760,6 +9760,38 @@  (define-public go-go-uber-org-multierr
      "@code{multierr} allows combining one or more Go errors together.")
     (license license:expat)))
 
+(define-public xurls
+  (package
+    (name "xurls")
+    (version "2.4.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mvdan/xurls")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0b040nbk1vwlk1qljavh8w8fn2r243q700n6gr8j2asmnz0xq84p"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "mvdan.cc/xurls/v2"
+       #:unpack-path "mvdan.cc/xurls/v2"
+       #:phases (modify-phases %standard-phases
+                  (replace 'build
+                    (lambda arguments
+                      (apply (assoc-ref %standard-phases
+                                        'build)
+                             `(,@arguments #:import-path
+                               "mvdan.cc/xurls/v2/cmd/xurls")))))))
+    (inputs (list go-golang-org-x-sync go-github-com-rogpeppe-go-internal))
+    (home-page "https://mvdan.cc/xurls/v2/")
+    (synopsis "Extracts URLs from text")
+    (description
+     "Xurls extracts urls from plain text using regular expressions.  It can
+be used as both a binary and a library.")
+    (license license:bsd-3)))
+
 (define-public go-golang-org-x-lint
   (let ((commit "83fdc39ff7b56453e3793356bcff3070b9b96445")
         (revision "0"))