summaryrefslogtreecommitdiff
path: root/gochan.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-18 01:34:32 -0600
committerJeff Carr <[email protected]>2024-01-18 01:34:32 -0600
commitf3d6daa29eccbaeb7b9b1709b4ddffe010c00bd0 (patch)
tree038e8e6183c95333f90153129d2c17cbdf099125 /gochan.go
parent939e87c2e960424fdb00849273fb1e1c2d871aad (diff)
fix paths
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gochan.go')
-rw-r--r--gochan.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/gochan.go b/gochan.go
index 8974815..49bd1bd 100644
--- a/gochan.go
+++ b/gochan.go
@@ -7,9 +7,9 @@ import (
"fmt"
"sync"
- "go.wit.com/log"
"go.wit.com/gui/gui"
- "go.wit.com/gui/gadgets"
+ "go.wit.com/lib/gadgets"
+ "go.wit.com/log"
)
var debugWG *sync.WaitGroup
@@ -24,8 +24,8 @@ func DebugGoChannels(p *gui.Node) *gadgets.BasicWindow {
g = w.Box().NewGroup("Channel stuff").Pad()
// var debugWG sync.WaitGroup
- g.NewButton("init()", func () {
- if (debugNumberChan == nil) {
+ g.NewButton("init()", func() {
+ if debugNumberChan == nil {
log.Log(CHAN, "making debugNumberChan channel")
debugNumberChan = make(chan int)
} else {
@@ -33,35 +33,35 @@ func DebugGoChannels(p *gui.Node) *gadgets.BasicWindow {
}
debugWG = new(sync.WaitGroup)
})
- g.NewButton("go printInt(x) (read x values off the channel)", func () {
- debugWG.Add(1)
- go printInt(2, "routine1")
- debugWG.Add(1)
- go printInt(2, "routine2")
+ g.NewButton("go printInt(x) (read x values off the channel)", func() {
+ debugWG.Add(1)
+ go printInt(2, "routine1")
+ debugWG.Add(1)
+ go printInt(2, "routine2")
})
- g.NewButton("sendNumber(2) (chan <- 2, 4)", func () {
+ g.NewButton("sendNumber(2) (chan <- 2, 4)", func() {
debugWG.Add(1)
debugWG.Add(1)
go sendNumber(2)
go sendNumber(4)
})
- g.NewButton("sendNumber(1) (chan <- 7)", func () {
+ g.NewButton("sendNumber(1) (chan <- 7)", func() {
debugWG.Add(1)
go sendNumber(7)
})
- g.NewButton("send 4 numbers (chan <- int)", func () {
+ g.NewButton("send 4 numbers (chan <- int)", func() {
log.Log(CHAN, "generateNumbers(4)")
go generateNumbers(4)
})
- g.NewButton("debugWG.Done()", func () {
+ g.NewButton("debugWG.Done()", func() {
log.Log(CHAN, "ran debugWG.Done()")
debugWG.Done()
})
- g.NewButton("close chan", func () {
+ g.NewButton("close chan", func() {
log.Log(CHAN, "close() on", debugNumberChan)
close(debugNumberChan)
})
- g.NewButton("print", func () {
+ g.NewButton("print", func() {
log.Log(CHAN, "waitgroup counter is ?")
})
return w
@@ -92,9 +92,9 @@ func printInt(i int, name string) {
tmp := 1
log.Log(CHAN, "START printInt", name, "read debugNumberChan()")
for num := range debugNumberChan {
- log.Log(CHAN, "printInt()",name, "read", num, "from channel")
+ log.Log(CHAN, "printInt()", name, "read", num, "from channel")
debugWG.Done()
- if (tmp == i) {
+ if tmp == i {
return
}
tmp += 1