Skip to content

Commit ba4a707

Browse files
committed
make worker private
1 parent 1f3a9a7 commit ba4a707

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

osc.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,16 @@ func serve(r readSender, numWorkers int, exactMatch bool, dispatcher Dispatcher)
137137
}
138138
var (
139139
errChan = make(chan error)
140-
ready = make(chan Worker, numWorkers)
140+
ready = make(chan worker, numWorkers)
141141
)
142142
for i := 0; i < numWorkers; i++ {
143-
go Worker{
143+
go worker{
144144
DataChan: make(chan Incoming),
145145
Dispatcher: dispatcher,
146146
ErrChan: errChan,
147147
Ready: ready,
148148
ExactMatch: exactMatch,
149-
}.Run()
149+
}.run()
150150
}
151151
go workerLoop(r, ready, errChan)
152152

@@ -161,7 +161,7 @@ func serve(r readSender, numWorkers int, exactMatch bool, dispatcher Dispatcher)
161161
return nil
162162
}
163163

164-
func workerLoop(r readSender, ready chan Worker, errChan chan error) {
164+
func workerLoop(r readSender, ready chan worker, errChan chan error) {
165165
for {
166166
data := make([]byte, bufSize)
167167
_, sender, err := r.read(data)

worker.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import (
44
"github.com/pkg/errors"
55
)
66

7-
// Worker is a worker who can process OSC messages.
8-
type Worker struct {
7+
// worker is a worker who can process OSC messages.
8+
type worker struct {
99
DataChan chan Incoming
1010
Dispatcher Dispatcher
1111
ErrChan chan error
12-
Ready chan<- Worker
12+
Ready chan<- worker
1313
ExactMatch bool
1414
}
1515

16-
// Run runs the worker.
17-
func (w Worker) Run() {
16+
// run runs the worker.
17+
func (w worker) run() {
1818
w.Ready <- w
1919

2020
DataLoop:

worker_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ func TestWorkerRun(t *testing.T) {
1111
var (
1212
data = make(chan Incoming)
1313
errch = make(chan error)
14-
ready = make(chan Worker)
14+
ready = make(chan worker)
1515
)
16-
worker := Worker{
16+
wrk := worker{
1717
DataChan: data,
1818
Dispatcher: errorDispatcher{},
1919
ErrChan: errch,
@@ -23,7 +23,7 @@ func TestWorkerRun(t *testing.T) {
2323
defer close(data)
2424

2525
// Run the worker goroutine.
26-
go worker.Run()
26+
go wrk.run()
2727

2828
// Wait for the worker to signal that it is ready.
2929
select {

0 commit comments

Comments
 (0)