diff --git a/examples/stateful-goroutines/stateful-goroutines.go b/examples/stateful-goroutines/stateful-goroutines.go index 598c4a9..59655bb 100644 --- a/examples/stateful-goroutines/stateful-goroutines.go +++ b/examples/stateful-goroutines/stateful-goroutines.go @@ -28,6 +28,7 @@ type readOp struct { key int resp chan int } + type writeOp struct { key int val int @@ -43,8 +44,8 @@ func main() { // The `reads` and `writes` channels will be used by // other goroutines to issue read and write requests, // respectively. - reads := make(chan *readOp) - writes := make(chan *writeOp) + reads := make(chan readOp) + writes := make(chan writeOp) // Here is the goroutine that owns the `state`, which // is a map as in the previous example but now private @@ -76,7 +77,7 @@ func main() { for r := 0; r < 100; r++ { go func() { for { - read := &readOp{ + read := readOp{ key: rand.Intn(5), resp: make(chan int)} reads <- read @@ -92,7 +93,7 @@ func main() { for w := 0; w < 10; w++ { go func() { for { - write := &writeOp{ + write := writeOp{ key: rand.Intn(5), val: rand.Intn(100), resp: make(chan bool)} diff --git a/examples/stateful-goroutines/stateful-goroutines.hash b/examples/stateful-goroutines/stateful-goroutines.hash index f88cfa8..4956f93 100644 --- a/examples/stateful-goroutines/stateful-goroutines.hash +++ b/examples/stateful-goroutines/stateful-goroutines.hash @@ -1,2 +1,2 @@ -ff8b7e93a43c284ada17f4387cc5dfeafa3ee316 -dlfBGF-qff6 +330fde708b006d5571f9b94e7a63b4fead62bd36 +DxITfgl__z9 diff --git a/public/stateful-goroutines b/public/stateful-goroutines index 17add47..144f1e9 100644 --- a/public/stateful-goroutines +++ b/public/stateful-goroutines @@ -34,7 +34,7 @@ by exactly 1 goroutine.

- +
package main
 
@@ -76,7 +76,18 @@ goroutine to respond.

key int resp chan int } -type writeOp struct { + + + + + + + + + + + +
type writeOp struct {
     key  int
     val  int
     resp chan bool
@@ -121,8 +132,8 @@ respectively.

-
    reads := make(chan *readOp)
-    writes := make(chan *writeOp)
+            
    reads := make(chan readOp)
+    writes := make(chan writeOp)
 
@@ -174,7 +185,7 @@ result over the provided resp channel.

    for r := 0; r < 100; r++ {
         go func() {
             for {
-                read := &readOp{
+                read := readOp{
                     key:  rand.Intn(5),
                     resp: make(chan int)}
                 reads <- read
@@ -200,7 +211,7 @@ approach.

    for w := 0; w < 10; w++ {
         go func() {
             for {
-                write := &writeOp{
+                write := writeOp{
                     key:  rand.Intn(5),
                     val:  rand.Intn(100),
                     resp: make(chan bool)}