diff mbox series

[bug#47591] import: go: Replace underscores with hyphens in package names.

Message ID bcd625f27e5acaaf9927590a1980f0f2a8566a07.1617528810.git.public@yoctocell.xyz
State Accepted
Headers show
Series [bug#47591] import: go: Replace underscores with hyphens in package names. | expand

Checks

Context Check Description
cbaines/submitting builds success
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Xinglu Chen April 4, 2021, 9:52 a.m. UTC
As per section '16.4.2 Package Naming' in the manual, use hypens instead
of underscores in package names.

* guix/import/go.scm (go-module->guix-package-name): Replace underscores
with hyphens.
---
Maybe we should also make the linter check for underscores in package
names, and give a warning if it finds any underscores?

 guix/import/go.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)


base-commit: 86617c92c6a795668b2eca3d3c3b285cb742cb24

Comments

Leo Famulari April 4, 2021, 5:43 p.m. UTC | #1
On Sun, Apr 04, 2021 at 11:52:03AM +0200, Xinglu Chen wrote:
> As per section '16.4.2 Package Naming' in the manual, use hypens instead
> of underscores in package names.
> 
> * guix/import/go.scm (go-module->guix-package-name): Replace underscores
> with hyphens.

Thanks! Pushed as 426ade6c8bdab243da719e369a887284368179bb

> Maybe we should also make the linter check for underscores in package
> names, and give a warning if it finds any underscores?

Definitely!

I would leave existing packages alone, however, unless they are causing
some problem.
Xinglu Chen April 5, 2021, 9:27 p.m. UTC | #2
On Sun, Apr 04 2021, Leo Famulari wrote:

>> Maybe we should also make the linter check for underscores in package
>> names, and give a warning if it finds any underscores?
>
> Definitely!
>
> I would leave existing packages alone, however, unless they are causing
> some problem.

Do you mean that there should be a whitelist for all the packages that
already have underscores in their names, or?

Also, there has been some discussion about replacing underscores in
package names[1].

[1]: https://yhetil.org/guix-devel/87v991vkpi.fsf@nckx
diff mbox series

Patch

diff --git a/guix/import/go.scm b/guix/import/go.scm
index 7452b4c903..6c0231e113 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -4,6 +4,7 @@ 
 ;;; Copyright © 2021 François Joulaud <francois.joulaud@radiofrance.com>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -380,9 +381,11 @@  hence the need to derive this information."
   "Converts a module's path to the canonical Guix format for Go packages."
   (string-downcase (string-append "go-" (string-replace-substring
                                          (string-replace-substring
-                                          module-path
-                                          "." "-")
-                                         "/" "-"))))
+                                          (string-replace-substring
+                                           module-path
+                                           "." "-")
+                                          "/" "-")
+                                         "_" "-"))))
 
 (define-record-type <module-meta>
   (make-module-meta import-prefix vcs repo-root)