From e32521de5b0badf8172058364611db147d562522 Mon Sep 17 00:00:00 2001 Message-Id: From: Sarah Morgensen Date: Thu, 5 Aug 2021 21:15:26 -0700 Subject: [PATCH 1/2] import: go: Allow version pinning for indirect dependencies. --- guix/import/go.scm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index 617a0d0e23..5c1a251677 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -349,12 +349,15 @@ DIRECTIVE." "Compute and return the list of requirements specified by GO.MOD." (define (replace directive requirements) (define (maybe-replace module-path new-requirement) - ;; Do not allow version updates for indirect dependencies (see: - ;; https://golang.org/ref/mod#go-mod-file-replace). - (if (and (equal? module-path (first new-requirement)) - (not (assoc-ref requirements module-path))) - requirements - (cons new-requirement (alist-delete module-path requirements)))) + ;; Since only one go.mod is considered at a time and hence not all the + ;; transitive requirements are known, we honor all the replacements, + ;; contrary to the upstream specification where only dependencies actually + ;; *required* get replaced. + ;; + ;; Notably, allow version pinning/updating for indirect dependencies. It + ;; is rare in practice, may be useful with --pin-versions, and at worst + ;; adds an extra direct input (which would be transitively included anyway). + (cons new-requirement (alist-delete module-path requirements))) (match directive ((('original ('module-path module-path) . _) with . _) base-commit: d0d3bcc615f1d521ea60a8b2e085767e0adb05b6 -- 2.31.1