Skip to content

Commit f2760d5

Browse files
committed
reformat
1 parent 86b65b6 commit f2760d5

File tree

7 files changed

+18
-14
lines changed

7 files changed

+18
-14
lines changed

fan_in_fixed_arguments.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ func BoringFanInFixedArguments(input1, input2 <-chan string) <-chan string {
66
go func() {
77
for {
88
select {
9-
case s := <-input1: c <- s
10-
case s := <-input2: c <- s
9+
case s := <-input1:
10+
c <- s
11+
case s := <-input2:
12+
c <- s
1113
}
1214
}
1315
}()
1416

1517
return c
16-
}
18+
}

fan_out_all.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package main
22

3-
func FanOutAll(input <-chan string, outs... chan<- string) {
3+
func FanOutAll(input <-chan string, outs ... chan<- string) {
44
go func() {
55
for {
66
msg := <-input
77
for _, out := range outs {
8-
go func(o chan<-string) {
8+
go func(o chan<- string) {
99
o <- msg
1010
}(out)
1111
}
1212
}
1313
}()
14-
}
14+
}

generator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
func BoringGenerator(msg string) <-chan string {
99
c := make(chan string)
1010

11-
go func(){
11+
go func() {
1212
for i := 0; ; i++ {
1313
c <- fmt.Sprintf("%s %d", msg, i)
1414
time.Sleep(time.Second)

receive_till_quit.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import "fmt"
55
func BoringReceiveTillQuit(input <-chan string, quit <-chan bool) {
66
for {
77
select {
8-
case s := <-input: fmt.Print(s)
8+
case s := <-input:
9+
fmt.Print(s)
910
case <-quit:
1011
fmt.Print("Oh ok that was nice talk")
1112
return

send_when_available.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77

88
type Request struct {
99
query string
10-
data chan string
10+
data chan string
1111
}
1212

13-
func SendWhenAvailable() chan<-Request {
13+
func SendWhenAvailable() chan<- Request {
1414
r := make(chan Request)
1515

1616
go func(r <-chan Request) {

sequential_fan_in.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import "fmt"
44

55
type Message struct {
6-
msg string
6+
msg string
77
wait chan bool
88
}
99

@@ -20,7 +20,7 @@ func BoringSyncedGenerator(msg string) <-chan Message {
2020
return m
2121
}
2222

23-
func BoringSequentialFanIn(syncedChans... <-chan Message) <-chan string {
23+
func BoringSequentialFanIn(syncedChans ... <-chan Message) <-chan string {
2424
c := make(chan string)
2525

2626
go func() {

synced_quit.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package main
22

33
import "fmt"
44

5-
func BoringSyncedQuit (input <-chan string, quit chan bool) {
5+
func BoringSyncedQuit(input <-chan string, quit chan bool) {
66
for {
77
select {
8-
case s := <-input: fmt.Print(s)
8+
case s := <-input:
9+
fmt.Print(s)
910
case <-quit:
1011
fmt.Print("Well see ya, bye")
1112
quit <- true

0 commit comments

Comments
 (0)