Skip to content

Commit 672e8f6

Browse files
committed
go fmt for go1.18beta
1 parent 3859d7a commit 672e8f6

File tree

9 files changed

+226
-204
lines changed

9 files changed

+226
-204
lines changed

actor.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ var Actor ActorDef[interface{}]
125125

126126
// AskDef[T, R] Ask inspired by Erlang/Akka
127127
type AskDef[T any, R any] struct {
128-
id time.Time
129-
ch *chan R
128+
id time.Time
129+
ch *chan R
130130

131131
Message T
132132
}
@@ -150,8 +150,8 @@ func AskNewGenerics[T any, R any](message T) *AskDef[T, R] {
150150
// AskNewByOptionsGenerics New Ask by its options
151151
func AskNewByOptionsGenerics[T any, R any](message T, ioCh *chan R) *AskDef[T, R] {
152152
newOne := AskDef[T, R]{
153-
id: time.Now(),
154-
ch: ioCh,
153+
id: time.Now(),
154+
ch: ioCh,
155155

156156
Message: message,
157157
}
@@ -169,8 +169,8 @@ func (askSelf *AskDef[T, R]) AskOnce(target ActorHandle[interface{}], timeout *t
169169
result = <-*ch
170170
} else {
171171
select {
172-
case result = <-*ch:
173-
case <-time.After(*timeout):
172+
case result = <-*ch:
173+
case <-time.After(*timeout):
174174
return result, ErrActorAskTimeout
175175
}
176176
}

actor_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,22 @@ func TestActorAsk(t *testing.T) {
9393
actorRoot := Actor.New(func(self *ActorDef[interface{}], input interface{}) {
9494
// Ask cases: ROOT
9595
switch val := input.(type) {
96-
case *AskDef[interface{}, int]:
97-
intVal, _ := Maybe.Just(val.Message).ToInt()
96+
case *AskDef[interface{}, int]:
97+
intVal, _ := Maybe.Just(val.Message).ToInt()
9898

99-
// NOTE If negative, hanging for testing Ask.timeout
100-
if intVal < 0 {
101-
break
102-
}
103-
104-
val.Reply(intVal * 10)
99+
// NOTE If negative, hanging for testing Ask.timeout
100+
if intVal < 0 {
105101
break
102+
}
103+
104+
val.Reply(intVal * 10)
105+
break
106106
}
107107
})
108108

109109
// var timer *time.Timer
110110
var timeout time.Duration
111-
timeout = 10*time.Millisecond
111+
timeout = 10 * time.Millisecond
112112

113113
// Normal cases
114114
actual = 0
@@ -124,7 +124,7 @@ func TestActorAsk(t *testing.T) {
124124
actual = 0
125125
expectedInt = 30
126126
ch := AskNewGenerics[interface{}, int](3).AskChannel(actorRoot)
127-
actual = <- *ch
127+
actual = <-*ch
128128
close(*ch)
129129
assert.Equal(t, expectedInt, actual)
130130

0 commit comments

Comments
 (0)