Subject: [bug#63647] [PATCH 0/2] Fix annoyance with "guix import go"

From: Sharlatan Hellseher <[email-masked]>
Date: Thu, 20 Feb 2025 14:12:48 +0000

Hi Simon

--8<---------------cut here---------------start------------->8---
[PATCH v3 3/3] guix: import: go: Use correct tag for go module in subdirectory.

* guix/import/go.scm (vcs->origin): New argument module-path-subdirectory.
Use it to get Git tag as described by <https://go.dev/ref/mod>.

Co-authored-by: Simon Tournier <[email-masked]>
--8<---------------cut here---------------end--------------->8---

It's on master already

a8d5d087086 * import/go: Add diagnostics.
296c78aab64 * import/go: Account for monorepo modules in the Go importer.
18a77fb3f85 * build-system/go: Add subdir parameter to go-version->git-ref.

Implemented by Christina O'Donnell <[email-masked]>

By running this "go import github.com/moby/sys/mountinfo" produces this
package definittion:

--8<---------------cut here---------------start------------->8---
(define-public go-github-com-moby-sys-mountinfo
  (package
    (name "go-github-com-moby-sys-mountinfo")
    (version "0.7.2")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/moby/sys")
             (commit (go-version->git-ref version
                                          #:subdir "mountinfo"))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1i1phx1kk9qa4jf1i1nl23d3f6k9fn2w46274cl76cqw9hjqg868"))))
    (build-system go-build-system)
    (arguments
     (list
      #:import-path "github.com/moby/sys/mountinfo"
      #:unpack-path "github.com/moby/sys"))
    (propagated-inputs (list go-golang-org-x-sys))
    (home-page "https://github.com/moby/sys")
    (synopsis #f)
    (description
     "Package mountinfo provides a set of functions to retrieve information about OS
mounts.")
    (license license:asl2.0)))
--8<---------------cut here---------------end--------------->8---

Which reflects Golang packaging requirements for Git tags submodules:

--8<---------------cut here---------------start------------->8---
git clone https://github.com/moby/sys
git -C sys tag --list
capability/v0.2.0
capability/v0.3.0
capability/v0.4.0
mount/v0.1.0
mount/v0.1.1
mount/v0.2.0
mount/v0.3.0
mount/v0.3.1
mount/v0.3.2
mount/v0.3.3
mount/v0.3.4
mountinfo/v0.1.0
mountinfo/v0.1.2
mountinfo/v0.1.3
mountinfo/v0.2.0
mountinfo/v0.3.0
mountinfo/v0.3.1
mountinfo/v0.4.0
mountinfo/v0.4.1
mountinfo/v0.5.0
mountinfo/v0.6.0
mountinfo/v0.6.1
mountinfo/v0.6.2
mountinfo/v0.7.0
mountinfo/v0.7.1
mountinfo/v0.7.2
reexec/v0.1.0
sequential/v0.5.0
sequential/v0.6.0
signal/v0.5.0
signal/v0.6.0
signal/v0.7.0
signal/v0.7.1
symlink/v0.1.0
symlink/v0.2.0
symlink/v0.3.0
user/v0.1.0
user/v0.2.0
user/v0.3.0
userns/v0.1.0
--8<---------------cut here---------------end--------------->8---

I guess this one is no longer required (please ensure me ;-)

--8<---------------cut here---------------start------------->8---
[PATCH v3 1/3] guix: import: go: Sort hint about available versions.

* guix/import/go.scm (validate-version): Sort available versions.
---
 guix/import/go.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
--8<---------------cut here---------------end--------------->8---

---
Oleg