Subject: [bug#73299] [PATCH v2 1/3] build/go: Replace symlinks with a copy of the file.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 26 Sep 2024 22:22:23 +0900

Hi Sharlatan,

Some small nitpicks below:

Sharlatan Hellseher <[email-masked]> writes:

> From: Efraim Flashner <[email-masked]>
>
> * guix/build/go-build-system.scm (fix-embed-files): New procedure.
> (%standard-phases): Add 'fix-embed-files after 'unpack.
> * guix/build-system/go.scm (#:embed-files): New key parameter.
> * doc/guix.texi: (go-build-system): Document a new key.
>
> Co-authored-by: Sharlatan Hellseher <[email-masked]>
> Change-Id: I27bc46fa1a3f4675ff73b6cba4ef5c3d177c22b1
> ---
>  doc/guix.texi                  |  8 ++++++++
>  guix/build-system/go.scm       |  6 ++++++
>  guix/build/go-build-system.scm | 30 ++++++++++++++++++++++++++++--
>  3 files changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 4abe258af0..e780bde6cf 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -130,6 +130,9 @@
>  Copyright @copyright{} 2024 Dariqq@*
>  Copyright @copyright{} 2024 Denis 'GNUtoo' Carikli@*
>  Copyright @copyright{} 2024 Fabio Natali@*
> +Copyright @copyright{} 2024 Troy Figiel@*

Is this accurate?  Should another Co-authored-by: git trailer be added
for them?

[...]

[...]

> diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
> index 3f0f5700a1..14cb5ae687 100644
> --- a/guix/build/go-build-system.scm
> +++ b/guix/build/go-build-system.scm
> @@ -4,10 +4,12 @@
>  ;;; Copyright © 2019 Maxim Cournoyer <[email-masked]>
>  ;;; Copyright © 2020 Jack Hill <[email-masked]>
>  ;;; Copyright © 2020 Jakub Kądziołka <[email-masked]>
> -;;; Copyright © 2020, 2021, 2023 Efraim Flashner <[email-masked]>
> +;;; Copyright © 2020, 2021, 2023, 2024 Efraim Flashner <[email-masked]>
>  ;;; Copyright © 2021 Sarah Morgensen <[email-masked]>
>  ;;; Copyright © 2024 Ekaitz Zarraga <[email-masked]>
>  ;;; Copyright © 2024 Picnoir <[email-masked]>
> +;;; Copyright © 2024 Troy Figiel <[email-masked]>
> +;;; Copyright © 2024 Sharlatan Hellseher <[email-masked]>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -28,8 +30,9 @@ (define-module (guix build go-build-system)
>    #:use-module ((guix build gnu-build-system) #:prefix gnu:)
>    #:use-module (guix build union)
>    #:use-module (guix build utils)
> -  #:use-module (ice-9 match)
> +  #:use-module (ice-9 format)
>    #:use-module (ice-9 ftw)
> +  #:use-module (ice-9 match)
>    #:use-module (srfi srfi-1)
>    #:use-module (rnrs io ports)
>    #:use-module (rnrs bytevectors)
> @@ -201,6 +204,28 @@ (define* (setup-go-environment #:key inputs outputs goos goarch #:allow-other-ke
>      (delete-file-recursively tmpdir))
>    #t)
>  
> +(define* (fix-embed-files #:key embed-files #:allow-other-keys)
> +  "Golang can't determine the valid directory of the module of embed file
                                                                 ^ *an* embed file
                                                                 or
                                                                 embed fileS

I typically prefer 'cannot' vs can't and likewise for 'do not' vs
doesn't, etc., which I feel reads more "formal".

> +which is symlinked during setup environment phase, but easy resolved after

easy resolved -> easily resolved

> +coping file from the store to the build directory of the current package. Take

coping file -> copying the file; missing double space before 'Take'.

> +a list of files or regexps matching files from EMBED-FILES paramter, failover

paramter -> parameter

> +to 'editions_defaults.binpb' which is a part of <github.com/golang/protobuf>."

> +  ;; see details in Golang source:

Please use fully punctuated sentences for standalone comments; e.g. :
"For the details, consult the Golang source:"

> +  ;;
> +  ;; - URL: <https://github.com/golang/go/blob/>
> +  ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
> +  ;; - file: src/cmd/go/internal/load/pkg.go#L2059

You could use github's raw URL for the file, which doesn't require any
javascript to be viewed.

That's it!  Thank you for working on improving Go on Guix.

-- 
Maxim