Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit cd1f5ca

Browse files
authored
Merge pull request #107 from Clever/retain-expected-call-order
retain ordering of expected calls
2 parents 18f6dd1 + 9575afe commit cd1f5ca

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

gomock/callset.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ func (cs callSet) Remove(call *Call) {
4343
sl := methodMap[call.method]
4444
for i, c := range sl {
4545
if c == call {
46-
// quick removal; we don't need to maintain call order
47-
if len(sl) > 1 {
48-
sl[i] = sl[len(sl)-1]
49-
}
50-
methodMap[call.method] = sl[:len(sl)-1]
46+
// maintain order for remaining calls
47+
methodMap[call.method] = append(sl[:i], sl[i+1:]...)
5148
break
5249
}
5350
}

0 commit comments

Comments
 (0)