summaryrefslogtreecommitdiff
path: root/debug.go
diff options
context:
space:
mode:
Diffstat (limited to 'debug.go')
-rw-r--r--debug.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/debug.go b/debug.go
index 18e147d..a06dd76 100644
--- a/debug.go
+++ b/debug.go
@@ -6,9 +6,13 @@ package main
// An app to submit patches for the 30 GO GUI repos
import (
+ "debug/buildinfo"
"fmt"
+ "os"
+ "path/filepath"
"time"
+ "go.wit.com/dev/davecgh/spew"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gui/shell"
@@ -26,6 +30,35 @@ func init() {
}
}
+func dumpDebug() {
+ // Get absolute path of the currently running binary
+ exePath, err := os.Executable()
+ if err != nil {
+ fmt.Println("Error getting executable path:", err)
+ return
+ }
+
+ // Resolve symlinks if necessary
+ exePath, err = filepath.EvalSymlinks(exePath)
+ if err != nil {
+ fmt.Println("Error resolving symlink:", err)
+ return
+ }
+
+ // Read build info
+ bi, err := buildinfo.ReadFile(exePath)
+ if err != nil {
+ fmt.Println("Error reading build info:", err)
+ return
+ }
+
+ log.Infof("%s built with Go version: %s\n", exePath, bi.GoVersion)
+ spew.Dump(bi)
+ for _, dep := range bi.Deps {
+ fmt.Printf("Dependency: %s %s\n", dep.Path, dep.Version)
+ }
+}
+
func debug() {
defer func() {
if r := recover(); r != nil {