[PATCH] import: go: Replace underscores with hyphens in package names.

  • Done
  • quality assurance status badge
Details
2 participants
  • Leo Famulari
  • Xinglu Chen
Owner
unassigned
Submitted by
Xinglu Chen
Severity
normal
X
X
Xinglu Chen wrote on 4 Apr 2021 11:52
(address . guix-patches@gnu.org)
bcd625f27e5acaaf9927590a1980f0f2a8566a07.1617528810.git.public@yoctocell.xyz
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(-)

Toggle diff (31 lines)
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)

base-commit: 86617c92c6a795668b2eca3d3c3b285cb742cb24
--
2.31.1
L
L
Leo Famulari wrote on 4 Apr 2021 19:43
(name . Xinglu Chen)(address . public@yoctocell.xyz)(address . 47591@debbugs.gnu.org)
YGn60QSN7cQRzK0b@jasmine.lan
On Sun, Apr 04, 2021 at 11:52:03AM +0200, Xinglu Chen wrote:
Toggle quote (6 lines)
> 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

Toggle quote (3 lines)
> 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.
L
L
Leo Famulari wrote on 4 Apr 2021 19:45
(no subject)
(address . control@debbugs.gnu.org)
YGn7Nq0o0xO2xF7r@jasmine.lan
close 47591
X
X
Xinglu Chen wrote on 5 Apr 2021 23:27
Re: [bug#47591] [PATCH] import: go: Replace underscores with hyphens in package names.
(name . Leo Famulari)(address . leo@famulari.name)(address . 47591@debbugs.gnu.org)
878s5wctgu.fsf@yoctocell.xyz
On Sun, Apr 04 2021, Leo Famulari wrote:

Toggle quote (8 lines)
>> 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].

?