Skip to content

Commit 1f05404

Browse files
committed
Rename context selector Receive
1 parent c7cded8 commit 1f05404

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

internal/sync/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func propagateCancel(parent Context, child canceler) {
184184

185185
Select(
186186
parent,
187-
ReceiveChan(done, func(ctx Context, c Channel) {
187+
Receive(done, func(ctx Context, c Channel) {
188188
// Parent is already canceled
189189
child.cancel(false, parent.Err())
190190
}),

internal/sync/context_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestWithCancel(t *testing.T) {
2525

2626
Select(
2727
ctx,
28-
ReceiveChan(ctx.Done(), func(ctx Context, c Channel) {
28+
Receive(ctx.Done(), func(ctx Context, c Channel) {
2929
canceled = true
3030
}),
3131
)

internal/sync/selector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func Await(f Future, handler func(Context, Future)) SelectCase {
2222
}
2323
}
2424

25-
func ReceiveChan(c Channel, handler func(Context, Channel)) SelectCase {
25+
func Receive(c Channel, handler func(Context, Channel)) SelectCase {
2626
channel := c.(*channel)
2727

2828
return &channelCase{

internal/sync/selector_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func Test_ChannelSelector_Select(t *testing.T) {
132132
// Wait for result
133133
Select(
134134
ctx,
135-
ReceiveChan(c, func(ctx Context, c Channel) {
135+
Receive(c, func(ctx Context, c Channel) {
136136
c.Receive(ctx, &r)
137137
}),
138138
)

samples/signal/signal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func Workflow1(ctx workflow.Context, msg string, subID string) (string, error) {
7777

7878
log.Println("Waiting for first signal")
7979
workflow.Select(ctx,
80-
workflow.ReceiveChan(workflow.NewSignalChannel(ctx, "test"), func(ctx workflow.Context, c sync.Channel) {
80+
workflow.Receive(workflow.NewSignalChannel(ctx, "test"), func(ctx workflow.Context, c sync.Channel) {
8181
var r int
8282
c.Receive(ctx, &r)
8383

@@ -106,7 +106,7 @@ func SubWorkflow1(ctx workflow.Context) (string, error) {
106106
defer log.Println("Leaving SubWorkflow1")
107107

108108
workflow.Select(ctx,
109-
workflow.ReceiveChan(workflow.NewSignalChannel(ctx, "sub-signal"), func(ctx workflow.Context, c sync.Channel) {
109+
workflow.Receive(workflow.NewSignalChannel(ctx, "sub-signal"), func(ctx workflow.Context, c sync.Channel) {
110110
c.Receive(ctx, nil)
111111
}),
112112
)

workflow/workflow.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ func Await(f Future, handler func(Context, Future)) SelectCase {
7575
return sync.Await(f, handler)
7676
}
7777

78-
func ReceiveChan(c Channel, handler func(Context, Channel)) SelectCase {
79-
return sync.ReceiveChan(c, handler)
78+
func Receive(c Channel, handler func(Context, Channel)) SelectCase {
79+
return sync.Receive(c, handler)
8080
}
8181

8282
func Default(handler func(Context)) SelectCase {

0 commit comments

Comments
 (0)