chore: add delve Go debugger to Guix manifest (#12662)
I did some research and experiments to get a working `delve` debugger using Guix, which could step Forgejo and inspect variables/call procedures. This suggested change captures the details in the Guix manifest to make that knowledge easier for others to reuse. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12662 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
This commit is contained in:
+49
-15
@@ -11,28 +11,62 @@
|
|||||||
;;; made available to fetch required Go and Node dependencies.
|
;;; made available to fetch required Go and Node dependencies.
|
||||||
;;;
|
;;;
|
||||||
#|
|
#|
|
||||||
|
|
||||||
guix shell -CNF --share=$HOME -m manifest.scm
|
guix shell -CNF --share=$HOME -m manifest.scm
|
||||||
export GOTOOLCHAIN=local # to use the Go binary from Guix
|
export GOTOOLCHAIN=local # to use the Go binary from Guix
|
||||||
export CC=gcc CGO_ENABLED=1
|
export CC=gcc CGO_ENABLED=1
|
||||||
|
# The following is to preserve debug info symbols:
|
||||||
|
export STRIP=0 CGO_CFLAGS='-O0 -g' EXTRA_GOFLAGS='-gcflags="all=-N -l"'
|
||||||
export TAGS="timetzdata sqlite sqlite_unlock_notify"
|
export TAGS="timetzdata sqlite sqlite_unlock_notify"
|
||||||
make clean
|
make clean
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
make test -j$(nproc) # run unit tests
|
make test -j$(nproc) # run unit tests
|
||||||
make test-sqlite -j$(nproc) # run integration tests
|
make test-sqlite -j$(nproc) # run integration tests
|
||||||
make watch # run an instance/rebuild on changes
|
make watch # run an instance/rebuild on changes
|
||||||
|
|
||||||
|
# For debugging, you can either attach the delve debugger like this:
|
||||||
|
dlv attach $(pgrep gitea)
|
||||||
|
|
||||||
|
# Or start Forgejo directly with it:
|
||||||
|
dlv exec ./gitea
|
||||||
|
|
||||||
|#
|
|#
|
||||||
(specifications->manifest
|
|
||||||
(list "bash-minimal"
|
(use-modules (guix packages)
|
||||||
"coreutils"
|
(guix utils))
|
||||||
"findutils"
|
|
||||||
"gcc-toolchain"
|
(define go-1.26 ;minimal version required by Forgejo
|
||||||
"git" ;libpcre support is required
|
(specification->package "go@1.26"))
|
||||||
"git-lfs"
|
|
||||||
"gnupg"
|
(define (package-with-go base go)
|
||||||
"go"
|
"Return a variant of BASE, a Guix package object built with GO, another
|
||||||
"grep"
|
package."
|
||||||
"make"
|
(package/inherit base
|
||||||
"node"
|
(arguments (ensure-keyword-arguments (package-arguments base)
|
||||||
"nss-certs"
|
(list #:go go)))))
|
||||||
"openssh"
|
|
||||||
"sed"))
|
(define packages-for-debugging
|
||||||
|
(list (specification->package "procps") ;pgrep
|
||||||
|
(package-with-go (specification->package "delve") go-1.26) ;debugger
|
||||||
|
(package-with-go (specification->package "gomacro") go-1.26))) ;Go REPL
|
||||||
|
|
||||||
|
(concatenate-manifests
|
||||||
|
(list
|
||||||
|
(packages->manifest
|
||||||
|
(append (list go-1.26)
|
||||||
|
packages-for-debugging))
|
||||||
|
(specifications->manifest
|
||||||
|
(list "bash-minimal"
|
||||||
|
"coreutils"
|
||||||
|
"diffutils"
|
||||||
|
"findutils"
|
||||||
|
"gcc-toolchain"
|
||||||
|
"git" ;libpcre support is required
|
||||||
|
"git-lfs"
|
||||||
|
"gnupg"
|
||||||
|
"grep"
|
||||||
|
"make"
|
||||||
|
"node"
|
||||||
|
"nss-certs"
|
||||||
|
"openssh"
|
||||||
|
"sed"))))
|
||||||
|
|||||||
Reference in New Issue
Block a user