summary refs log tree commit diff
diff options
context:
space:
mode:
authorSharlatan Hellseher <sharlatanus@gmail.com>2024-09-19 14:00:56 +0100
committerSharlatan Hellseher <sharlatanus@gmail.com>2024-11-09 21:33:51 +0000
commit9ff0a399438b11a5a4e248565df3512343896e1c (patch)
tree1565cb6abb41c774c9195f9b17fcd3ffb41552f9
parent922d0170818b6f9ba55b6202825f689b645419eb (diff)
downloadguix-9ff0a399438b11a5a4e248565df3512343896e1c.tar.gz
gnu: build/go: Apply default 'fix-embed-files phase.
These changes remove redundant phases where files, requiring to be embed
during build or check phases, are copied to the build directory as
proposed in <https://issues.guix.gnu.org/73299>.

* gnu/packages/backup.scm (restic-rest-server) [arguments]: <#:phases>:
Remove 'fix-embed-files phase.
* gnu/packages/configuration-management.scm (chezmoi): Likewise.
* gnu/packages/packages/golang-build.scm (go-github-com-golang-protobuf): Likewise.
* gnu/packages/golang-web.scm (go-github-com-go-openapi-loads,
go-github-com-go-openapi-runtime, go-github-com-golang-groupcache): Likewise.
* gnu/packages/golang-xyz.scm (go-github-com-dgraph-io-badger): Likewise.
* gnu/packages/golang.scm (go-github-com-ssgelm-cookiejarparser): Likewise.
* gnu/packages/ipfs.scm (go-github-com-ipfs-go-ds-badger,
go-github-com-libp2p-go-libp2p, kubo): Likewise.
* gnu/packages/irc.scm (soju): Likewise.
* gnu/packages/networking.scm (nebula): Likewise.
* gnu/packages/prometheus.scm (go-github-com-nbrownus-go-metrics-prometheus,
go-github-com-prometheus-client-golang, go-github-com-prometheus-common,
go-github-com-prometheus-common-sigv4, go-github-com-prometheus-exporter-toolkit,
go-github-com-prometheus-statsd-exporter): Likewise
* gnu/packages/version-control.scm (git-lfs): Likewise.
* gnu/packages/web.scm (miniflux): Likewise.

* gnu/packages/golang-crypto.scm (go-filippo-io-age): [arguments]:
<#:phases>: Remove 'copy-input-to-vendor-direcotyr and
'remove-vendor-directory phases.
* gnu/packages/golang-web.scm (go-github-com-go-openapi-analysis,
go-github-com-go-openapi-analysis, go-github-com-go-openapi-validate): Likewise.
* gnu/packages/golang.scm (go-github-com-charmbracelet-glamour): Likewise.
* gnu/packages/textutils.scm (vale): Likewise.

Change-Id: Ic2ec01c8caf86f3ae69d7a1812c1e0b78a549e91
-rw-r--r--gnu/packages/backup.scm18
-rw-r--r--gnu/packages/configuration-management.scm21
-rw-r--r--gnu/packages/golang-build.scm18
-rw-r--r--gnu/packages/golang-crypto.scm31
-rw-r--r--gnu/packages/golang-web.scm133
-rw-r--r--gnu/packages/golang-xyz.scm84
-rw-r--r--gnu/packages/golang.scm39
-rw-r--r--gnu/packages/ipfs.scm69
-rw-r--r--gnu/packages/irc.scm18
-rw-r--r--gnu/packages/networking.scm18
-rw-r--r--gnu/packages/prometheus.scm122
-rw-r--r--gnu/packages/textutils.scm27
-rw-r--r--gnu/packages/version-control.scm8
-rw-r--r--gnu/packages/web.scm18
14 files changed, 31 insertions, 593 deletions
diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index 025398888f..0973c5ddca 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -1058,24 +1058,6 @@ precious backup space.
       #:unpack-path "github.com/restic/rest-server"
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$"))))
           ;; Unit tests seems to break with Guix' non-standard TMPDIR.
           (add-before 'check 'set-tmpdir
             (lambda _
diff --git a/gnu/packages/configuration-management.scm b/gnu/packages/configuration-management.scm
index 6d81f0dcac..b654975a42 100644
--- a/gnu/packages/configuration-management.scm
+++ b/gnu/packages/configuration-management.scm
@@ -50,6 +50,7 @@
     (arguments
      (list
       #:import-path "github.com/twpayne/chezmoi"
+      #:embed-files #~(list ".*\\.xml")
       #:install-source? #f
       #:phases
       #~(modify-phases %standard-phases
@@ -80,25 +81,7 @@
                           "secretkeepassxc.txt"
                           "secretlastpass.txt"
                           "secretonepassword.txt"
-                          "secretpass.txt"))))
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" (string-append "\\.xml$"))))))))
+                          "secretpass.txt")))))))
     (native-inputs
      (list go-github-com-masterminds-sprig-v3
            go-github-com-bmatcuk-doublestar-v2
diff --git a/gnu/packages/golang-build.scm b/gnu/packages/golang-build.scm
index 8fdd652b63..7049acf8c2 100644
--- a/gnu/packages/golang-build.scm
+++ b/gnu/packages/golang-build.scm
@@ -103,24 +103,6 @@ functions that have a name matched by regex:.")
       #:import-path "github.com/golang/protobuf"
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$"))))
           ;; XXX: Workaround for go-build-system's lack of Go modules
           ;; support.
           (delete 'build)
diff --git a/gnu/packages/golang-crypto.scm b/gnu/packages/golang-crypto.scm
index 016592e776..9a845612a3 100644
--- a/gnu/packages/golang-crypto.scm
+++ b/gnu/packages/golang-crypto.scm
@@ -137,33 +137,10 @@ can be ignored.")
     (build-system go-build-system)
     (arguments
      (list
-      #:import-path "filippo.io/age"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; FIXME: src/c2sp.org/CCTV/age/age.go:13:12: pattern testdata:
-          ;; cannot embed directory testdata: contains no embeddable files
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module which is sourced during setup environment phase, but
-          ;; easy resolved after coping to expected directory "vendor" within
-          ;; the current package, see details in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-before 'build 'copy-input-to-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (mkdir "vendor")
-                (copy-recursively
-                 (string-append
-                  #$(this-package-native-input "go-c2sp-org-cctv-age")
-                  "/src/c2sp.org")
-                 "vendor/c2sp.org"))))
-          (add-before 'install 'remove-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (delete-file-recursively "vendor")))))))
+      #:embed-files #~(list "armor.*" "header_crlf" "hmac_.*" "scrypt.*"
+                            "stanza_.*" "stream_.*" "version_unsupported"
+                            "x25519.*" "x25519_.*")
+      #:import-path "filippo.io/age"))
     (native-inputs
      (list go-c2sp-org-cctv-age
            go-github-com-rogpeppe-go-internal))
diff --git a/gnu/packages/golang-web.scm b/gnu/packages/golang-web.scm
index 9bfb01072b..885b93d63d 100644
--- a/gnu/packages/golang-web.scm
+++ b/gnu/packages/golang-web.scm
@@ -1596,6 +1596,7 @@ language.")
     (build-system go-build-system)
     (arguments
      (list
+      #:embed-files #~(list "jsonschema-draft-04\\.json" "schema\\.json")
       #:import-path "github.com/go-openapi/analysis"
       #:phases
       #~(modify-phases %standard-phases
@@ -1606,35 +1607,11 @@ language.")
                   ;; Tests requiring network access.
                   (("TestFlatten_RemoteAbsolute")
                    "OffTestFlatten_RemoteAbsolute")))))
-          ;; FIXME: pattern schemas/*.json: cannot embed irregular file
-          ;; schemas/jsonschema-draft-04.json
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module which is sourced during setup environment phase, but
-          ;; easy resolved after coping to expected directory "vendor" within
-          ;; the current package, see details in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-before 'build 'copy-input-to-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (mkdir "vendor")
-                (copy-recursively
-                 (string-append
-                  #$(this-package-input "go-github-com-go-openapi-spec")
-                  "/src/github.com")
-                 "vendor/github.com"))))
           (replace 'check
             (lambda* (#:key tests? import-path #:allow-other-keys)
               (when tests?
                 (with-directory-excursion (string-append "src/" import-path)
-                  (invoke "go" "test" "-v" "./...")))))
-          (add-before 'install 'remove-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (delete-file-recursively "vendor")))))))
+                  (invoke "go" "test" "-v" "./..."))))))))
     (native-inputs
      (list go-github-com-stretchr-testify))
     (propagated-inputs
@@ -1749,28 +1726,8 @@ prototyped in @url{https://github.com/xeipuuv/gojsonreference}.")
     (build-system go-build-system)
     (arguments
      (list
-      #:import-path "github.com/go-openapi/loads"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src"
-                                    "^(jsonschema-draft-04|schema)\\.json$")))))))
+      #:embed-files #~(list "jsonschema-draft-04\\.json" "schema\\.json")
+      #:import-path "github.com/go-openapi/loads"))
     (native-inputs
      (list go-github-com-stretchr-testify))
     (propagated-inputs
@@ -1802,27 +1759,8 @@ Supports JSON and YAML documents.")
     (build-system go-build-system)
     (arguments
      (list
-      #:import-path "github.com/go-openapi/runtime"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" "\\.json$")))))))
+      #:embed-files #~(list "jsonschema-draft-04\\.json" "schema\\.json")
+      #:import-path "github.com/go-openapi/runtime"))
     (native-inputs
      (list go-github-com-stretchr-testify))
     (propagated-inputs
@@ -1957,6 +1895,7 @@ projects.")
     (build-system go-build-system)
     (arguments
      (list
+      #:embed-files #~(list "jsonschema-draft-04\\.json" "schema\\.json")
       #:import-path "github.com/go-openapi/validate"
       #:phases
       #~(modify-phases %standard-phases
@@ -1967,41 +1906,7 @@ projects.")
                 (for-each delete-file
                           (list "benchmark_test.go"
                                 "example_validator_test.go"
-                                "doc_test.go")))))
-          ;; FIXME: pattern schemas/*.json: cannot embed irregular file
-          ;; schemas/jsonschema-draft-04.json
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module which is sourced during setup environment phase, but
-          ;; easy resolved after coping to expected directory "vendor" within
-          ;; the current package, see details in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-before 'build 'copy-input-to-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (mkdir "vendor")
-                (copy-recursively
-                 (string-append
-                  #$(this-package-input "go-github-com-go-openapi-loads")
-                  "/src/github.com")
-                 "vendor/github.com")
-                (copy-recursively
-                 (string-append
-                  #$(this-package-input "go-github-com-go-openapi-spec")
-                  "/src/github.com")
-                 "vendor/github.com")
-                (copy-recursively
-                 (string-append
-                  #$(this-package-input "go-github-com-go-openapi-analysis")
-                  "/src/github.com")
-                 "vendor/github.com"))))
-          (add-before 'install 'remove-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (delete-file-recursively "vendor")))))))
+                                "doc_test.go"))))))))
     (native-inputs
      (list go-github-com-stretchr-testify))
     (propagated-inputs
@@ -2169,27 +2074,7 @@ from CloudFlare's github.com/cloudflare/cfssl/revoke.")
     (build-system go-build-system)
     (arguments
      (list
-      #:import-path "github.com/golang/groupcache"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$")))))))
+      #:import-path "github.com/golang/groupcache"))
     (propagated-inputs
      (list go-github-com-golang-protobuf))
     (home-page "https://github.com/golang/groupcache")
diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm
index 14ad1fcbd5..d3738450cf 100644
--- a/gnu/packages/golang-xyz.scm
+++ b/gnu/packages/golang-xyz.scm
@@ -2110,25 +2110,6 @@ encoding/decoding.  It has no dependencies.")
       #:import-path "github.com/dgraph-io/badger"
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" (string-append
-                                           ".*(editions_defaults.binpb)$")))))
           (add-after 'unpack 'patch-failing-tests
             (lambda* (#:key unpack-path tests? #:allow-other-keys)
               (with-directory-excursion (string-append "src/" unpack-path)
@@ -4595,24 +4576,6 @@ allocator.  This is primarily useful for long lived buffers that usually sit emp
       #:import-path "github.com/libp2p/go-msgio"
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$"))))
           ;; XXX: Replace when go-build-system supports nested path.
           (replace 'check
             (lambda* (#:key import-path tests? #:allow-other-keys)
@@ -5164,24 +5127,6 @@ other directories.  It is optimized for filewalking.")
       #:import-path "github.com/matttproud/golang_protobuf_extensions/v2"
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$"))))
           ;; XXX: Activate when go-build-system supports submodules.
           (delete 'build)
           ;; XXX: Replace when go-build-system supports nested path.
@@ -5776,33 +5721,8 @@ list of sentences.")
     (build-system go-build-system)
     (arguments
      (list
-      #:import-path "github.com/niklasfasching/go-org"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; FIXME: Pattern embedded: cannot embed directory embedded:
-          ;; contains no embeddable files.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module which is sourced during setup environment phase, but
-          ;; easy resolved after coping to expected directory "vendor" within
-          ;; the current package, see details in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-before 'build 'copy-input-to-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (mkdir "vendor")
-                (copy-recursively
-                 (string-append
-                  #$(this-package-input "go-github-com-alecthomas-chroma-v2")
-                  "/src/github.com")
-                 "vendor/github.com"))))
-          (add-before 'install 'remove-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (delete-file-recursively "vendor")))))))
+      #:embed-files #~(list ".*\\.xml")
+      #:import-path "github.com/niklasfasching/go-org"))
     (propagated-inputs
      (list go-golang-org-x-net
            go-github-com-pmezard-go-difflib
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 8887e36da2..612a4896da 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -5899,6 +5899,7 @@ size of the terminal.")
     (build-system go-build-system)
     (arguments
      (list
+      #:embed-files #~(list ".*\\.xml")
       #:import-path "github.com/charmbracelet/glamour"
       #:phases
       #~(modify-phases %standard-phases
@@ -5912,31 +5913,7 @@ size of the terminal.")
                      #o644)
               (substitute* "src/github.com/charmbracelet/glamour/glamour_test.go"
                 (("	generate = false")
-                 "	generate = true"))))
-          ;; FIXME: Pattern embedded: cannot embed directory embedded:
-          ;; contains no embeddable files.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module which is sourced during setup environment phase, but
-          ;; easy resolved after coping to expected directory "vendor" within
-          ;; the current package, see details in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-before 'build 'copy-input-to-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (mkdir "vendor")
-                (copy-recursively
-                 (string-append
-                  #$(this-package-input "go-github-com-alecthomas-chroma-v2")
-                  "/src/github.com")
-                 "vendor/github.com"))))
-          (add-before 'install 'remove-vendor-directory
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (delete-file-recursively "vendor")))))))
+                 "	generate = true")))))))
     (propagated-inputs
      (list go-github-com-alecthomas-chroma-v2
            go-github-com-microcosm-cc-bluemonday
@@ -7763,16 +7740,8 @@ of the current user.")
     (build-system go-build-system)
     (arguments
      (list
-      #:import-path "github.com/ssgelm/cookiejarparser"
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'fix-embed-x-net
-            (lambda _
-              (delete-file-recursively "src/golang.org/x/net/publicsuffix/data")
-              (copy-recursively
-               #$(file-append (this-package-input "go-golang-org-x-net")
-                              "/src/golang.org/x/net/publicsuffix/data")
-               "src/golang.org/x/net/publicsuffix/data"))))))
+      #:embed-files #~(list "children" "nodes" "text")
+      #:import-path "github.com/ssgelm/cookiejarparser"))
     (propagated-inputs (list go-golang-org-x-net))
     (home-page "https://github.com/ssgelm/cookiejarparser")
     (synopsis "Parse a curl cookiejar with Go")
diff --git a/gnu/packages/ipfs.scm b/gnu/packages/ipfs.scm
index f01f5f53c1..d5849a3f18 100644
--- a/gnu/packages/ipfs.scm
+++ b/gnu/packages/ipfs.scm
@@ -354,27 +354,7 @@ throughout its lifetime.")
      (list
       ;; XXX: Tests time out, figure out workaround.
       #:tests? #f
-      #:import-path "github.com/ipfs/go-ds-badger"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$")))))))
+      #:import-path "github.com/ipfs/go-ds-badger"))
     (propagated-inputs
      (list go-github-com-dgraph-io-badger
            go-github-com-ipfs-go-datastore
@@ -854,30 +834,8 @@ their levels to be controlled individually.")
     (build-system go-build-system)
     (arguments
      (list
-      #:import-path "github.com/libp2p/go-libp2p"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each
-               (lambda (file)
-                 (let ((file-store-path (readlink file)))
-                   (delete-file file)
-                   (copy-recursively file-store-path file)))
-               (find-files "src" (string-append
-                                  ".*(editions_defaults.binpb"
-                                  "|sorted-network-list.bin)$"))))))))
+      #:embed-files #~(list "sorted-network-list.bin")
+      #:import-path "github.com/libp2p/go-libp2p"))
     (propagated-inputs
      (list go-github-com-benbjohnson-clock
            go-github-com-davidlazar-go-crypto
@@ -1098,30 +1056,11 @@ types.")
     (build-system go-build-system)
     (arguments
      (list
+      #:embed-files #~(list "sorted-network-list.bin")
       #:unpack-path "github.com/ipfs/kubo"
       #:import-path "github.com/ipfs/kubo/cmd/ipfs"
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" (string-append
-                                           ".*(editions_defaults.binpb"
-                                           "|sorted-network-list.bin)$")))))
           ;; https://github.com/ipfs/kubo/blob/master/docs/command-completion.md
           (add-after 'install 'install-bashcompletion
             (lambda _
diff --git a/gnu/packages/irc.scm b/gnu/packages/irc.scm
index e75432673e..51bd43869e 100644
--- a/gnu/packages/irc.scm
+++ b/gnu/packages/irc.scm
@@ -1160,24 +1160,6 @@ what.")
       #:import-path "codeberg.org/emersion/soju"
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$"))))
           (add-after 'unpack 'adjust-makefile
             (lambda* (#:key import-path #:allow-other-keys)
               (with-directory-excursion (string-append "src/" import-path)
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 8cd49992ec..6e3a355bd4 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -4779,24 +4779,6 @@ IPv6 Internet connectivity - it also works over IPv4.")
       #:install-source? #f
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$"))))
           (replace 'build
             (lambda* (#:key import-path #:allow-other-keys)
               ;; Suggested option to provide build time flags is not supported
diff --git a/gnu/packages/prometheus.scm b/gnu/packages/prometheus.scm
index fe2fa18e95..3e3a51b805 100644
--- a/gnu/packages/prometheus.scm
+++ b/gnu/packages/prometheus.scm
@@ -112,27 +112,7 @@ x/net/trace)} tracing wrappers @code{net.Conn}, both inbound
       ;; The project looks abandoned, tests failed with a new go-metrics, see
       ;; <https://github.com/nbrownus/go-metrics-prometheus/pull/2>.
       #:tests? #f
-      #:import-path "github.com/nbrownus/go-metrics-prometheus"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$")))))))
+      #:import-path "github.com/nbrownus/go-metrics-prometheus"))
     (native-inputs
      (list go-github-com-stretchr-testify))
     (propagated-inputs
@@ -169,25 +149,6 @@ registry.")
       #:import-path "github.com/prometheus/client_golang"
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-before 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" (string-append
-                                           ".*(editions_defaults.binpb)$")))))
           (add-after 'unpack 'remove-examples-and-tutorials
             (lambda* (#:key import-path #:allow-other-keys)
               (with-directory-excursion (string-append "src/" import-path)
@@ -278,25 +239,6 @@ Prometheus metrics.")
       #:import-path "github.com/prometheus/common"
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" (string-append
-                                           ".*(editions_defaults.binpb)$")))))
           ;; XXX: Workaround for go-build-system's lack of Go modules support.
           (delete 'build)
           (replace 'check
@@ -408,27 +350,7 @@ metrics.")
     (arguments
      (list
       #:import-path "github.com/prometheus/common/sigv4"
-      #:unpack-path "github.com/prometheus/common"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$")))))))
+      #:unpack-path "github.com/prometheus/common"))
     (native-inputs
      (list go-github-com-stretchr-testify))
     (propagated-inputs
@@ -463,22 +385,6 @@ from the default AWS credential chain.")
       #:import-path "github.com/prometheus/exporter-toolkit"
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'fix-embed-editions-defaults-binpb
-            (lambda _
-              (let* ((import-path "google.golang.org/protobuf")
-                     (subdir "internal/editiondefaults")
-                     (embed-file "editions_defaults.binpb")
-                     (embed-file-path
-                      (string-append "src/"
-                                     import-path "/"
-                                     subdir "/"
-                                     embed-file)))
-                (delete-file-recursively embed-file-path)
-                (copy-file
-                 (string-append
-                  #$(this-package-native-input "go-google-golang-org-protobuf")
-                  "/" embed-file-path)
-                 embed-file-path))))
           ;; XXX: Workaround for go-build-system's lack of Go modules support.
           (delete 'build)
           (replace 'check
@@ -572,29 +478,7 @@ kernel, and process metrics from the @file{/proc} pseudo file system.")
     (arguments
      (list
       #:import-path "github.com/prometheus/statsd_exporter"
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-before 'build 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" (string-append
-                                           ".*(editions_defaults.binpb"
-                                           "|landing_page.css"
-                                           "|landing_page.html)$"))))))))
+      #:embed-files #~(list "landing_page.css" "landing_page.html")))
     (native-inputs
      (list go-github-com-stvp-go-udp-testing))
     (propagated-inputs
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index deebd893d6..22a40866c9 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -1517,6 +1517,7 @@ of a Unix terminal to HTML code.")
     (arguments
      (list
       #:install-source? #f
+      #:embed-files #~(list ".*\\.gob")
       #:import-path "github.com/errata-ai/vale/cmd/vale"
       #:unpack-path "github.com/errata-ai/vale"
       #:phases
@@ -1536,26 +1537,6 @@ of a Unix terminal to HTML code.")
                   (("TestLocalZip") "OffTestLocalZip")
                   (("TestNoPkgFound") "OffTestNoPkgFound")
                   (("TestV3Pkg") "OffTestV3Pkg")))))
-          ;; FIXME: Pattern embedded: cannot embed directory embedded:
-          ;; contains no embeddable files.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module which is sourced during setup environment phase, but
-          ;; easy resolved after coping to expected directory "vendor" within
-          ;; the current package, see details in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-before 'build 'copy-input-to-vendor-directory
-            (lambda* (#:key unpack-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" unpack-path)
-                (mkdir "vendor")
-                (copy-recursively
-                 (string-append
-                  #$(this-package-native-input "go-github-com-jdkato-twine")
-                  "/src/github.com")
-                 "vendor/github.com"))))
           ;; XXX: Workaround for go-build-system's lack of Go modules
           ;; support.
           (replace 'check
@@ -1563,11 +1544,7 @@ of a Unix terminal to HTML code.")
               (when tests?
                 (with-directory-excursion (string-append "src/" unpack-path)
                   (setenv "HOME" "/tmp")
-                  (invoke "go" "test" "-v" "./...")))))
-          (add-before 'install 'remove-vendor-directory
-            (lambda* (#:key unpack-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" unpack-path)
-                (delete-file-recursively "vendor")))))))
+                  (invoke "go" "test" "-v" "./..."))))))))
     (native-inputs
      (list go-github-com-masterminds-sprig-v3
            go-github-com-adrg-strutil
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 9a703e9bbc..c892a83a98 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -3686,6 +3686,7 @@ will reconstruct the object along its delta-base chain and return it.")
     (build-system go-build-system)
     (arguments
      (list
+      #:embed-files #~(list "children" "nodes" "text")
       #:import-path "github.com/git-lfs/git-lfs"
       #:install-source? #f
       #:phases
@@ -3695,13 +3696,6 @@ will reconstruct the object along its delta-base chain and return it.")
               (substitute* "src/github.com/git-lfs/git-lfs/lfs/hook.go"
                 (("/bin/sh")
                  (search-input-file inputs "bin/sh")))))
-          (add-after 'unpack 'fix-embed-x-net
-            (lambda _
-              (delete-file-recursively "src/golang.org/x/net/publicsuffix/data")
-              (copy-recursively
-               #$(file-append (this-package-input "go-golang-org-x-net")
-                              "/src/golang.org/x/net/publicsuffix/data")
-               "src/golang.org/x/net/publicsuffix/data")))
           ;; Only build the man pages if ruby-asciidoctor is available.
           #$@(if (this-package-native-input "ruby-asciidoctor")
                #~((add-before 'build 'man-gen
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index e5b53e226b..d21f3f09e6 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -367,24 +367,6 @@ and its related documentation.")
                #$version))
       #:phases
       #~(modify-phases %standard-phases
-          ;; TODO: Implement it in go-build-system.
-          ;;
-          ;; This happens due to Golang can't determine the valid directory of
-          ;; the module of embed file which is symlinked during setup
-          ;; environment phase, but easy resolved after coping file from the
-          ;; store to the build directory of the current package, see details
-          ;; in Golang source:
-          ;;
-          ;; - URL: <https://github.com/golang/go/blob/>
-          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
-          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
-          (add-after 'unpack 'fix-embed-files
-            (lambda _
-              (for-each (lambda (file)
-                          (let ((file-store-path (readlink file)))
-                            (delete-file file)
-                            (copy-recursively file-store-path file)))
-                        (find-files "src" ".*(editions_defaults.binpb)$"))))
           ;; XXX: Replace when go-build-system supports nested path.
           (replace 'check
             (lambda* (#:key import-path tests? #:allow-other-keys)