summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-12 10:14:50 -0600
committerJeff Carr <[email protected]>2024-02-12 10:14:50 -0600
commitbc01313a04ddb0cfe5eae72a0e04995765a53c84 (patch)
tree3c4b6a8fb779eb2c61c6216137d697ba7ed89705
parent0949113167e0b37a4ba35637c3f6f6a2d0d14e8d (diff)
use standard debugger.gov0.21.0v0.20.7v0.20.6v0.20.5v0.20.4
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--Makefile25
-rw-r--r--args.go27
-rw-r--r--debugger.go26
-rw-r--r--main.go12
4 files changed, 33 insertions, 57 deletions
diff --git a/Makefile b/Makefile
index 91eb0a7..5527cb2 100644
--- a/Makefile
+++ b/Makefile
@@ -8,14 +8,11 @@ nocui: build
gocui: build
reset
- ./gadgetwindow --gui gocui >/tmp/gadgetwindow.stderr 2>&1
- # ./gadgetwindow --gui gocui --tmp-log
+ echo "redirecting STDOUT & STDERR to /tmp/gadgetwindow.out"
+ ./gadgetwindow --gui gocui >/tmp/gadgetwindow.out 2>&1
log:
- tail -f /tmp/guilogfile /tmp/witgui.* /tmp/gadget*
-
-test-tmp-log: build
- ./gadgetwindow --gui andlabs --tmp-log
+ tail -f /tmp/gadgetwindow.out*
debugger: build
reset
@@ -23,22 +20,15 @@ debugger: build
build:
ifeq ($(GO111MODULE),)
- echo no. you must use GO111MODULE here
- false
+ @echo
+ @echo In GO, to build here you must export GO111MODULE=off
+ @echo
+ @false
else
-rm -f gadgetwindow
go build -v -x
endif
-stderr: build
- echo "writing to /tmp/gadgetwindow.stderr"
- ./gadgetwindow >/tmp/gadgetwindow.stderr 2>&1
-
-push:
- git add --all
- git commit -a
- git push
-
goimports:
goimports -w *.go
@@ -47,4 +37,3 @@ redomod:
goimports -w *.go
GO111MODULE= go mod init
GO111MODULE= go mod tidy
-
diff --git a/args.go b/args.go
deleted file mode 100644
index 1c38249..0000000
--- a/args.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package main
-
-/*
- this parses the command line arguements
-
- this enables command line options from other packages like 'gui' and 'log'
-*/
-
-import (
- "go.wit.com/dev/alexflint/arg"
- "go.wit.com/lib/debugger"
- "go.wit.com/log"
-)
-
-var args struct {
- TmpLog bool `arg:"--tmp-log" help:"automatically send STDOUT to /tmp"`
-}
-
-func init() {
- arg.MustParse(&args)
-
- if debugger.ArgDebug() {
- log.Info("cmd line --debugger == true")
- } else {
- log.Info("cmd line --debugger == false")
- }
-}
diff --git a/debugger.go b/debugger.go
new file mode 100644
index 0000000..116d549
--- /dev/null
+++ b/debugger.go
@@ -0,0 +1,26 @@
+package main
+
+/*
+ enables GUI options and the debugger in your application
+*/
+
+import (
+ "go.wit.com/dev/alexflint/arg"
+ "go.wit.com/lib/debugger"
+ "go.wit.com/log"
+)
+
+var args struct {
+}
+
+func init() {
+ arg.MustParse(&args)
+
+ if debugger.ArgDebug() {
+ log.Info("cmd line --debugger == true")
+ go func() {
+ log.Sleep(2)
+ debugger.DebugWindow()
+ }()
+ }
+}
diff --git a/main.go b/main.go
index 25d9a58..2204571 100644
--- a/main.go
+++ b/main.go
@@ -27,24 +27,12 @@ func main() {
log.SetAll(true)
log.ShowFlags()
}
- if args.TmpLog {
- // send all log() output to a file in /tmp
- log.SetTmp()
- }
myGui = gui.New()
myGui.Default()
helloworld()
basicWindow = makebasicWindow()
- // run the debugger if triggered from the commandline
- if debugger.ArgDebug() {
- go func() {
- log.Sleep(2)
- debugger.DebugWindow()
- }()
- }
-
// go will sit here until the window exits
gui.Watchdog()
}