Skip to content

Commit f2ccf06

Browse files
committed
red is possible, let's get this to green
1 parent 3a20fe9 commit f2ccf06

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

mirror.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,14 @@ func CanConvert(from, to reflect.Type) bool {
4040
return false
4141
}
4242
case reflect.Struct:
43-
if recurseStructs <= 0 && tsf.Name() != ttf.Name() {
43+
if tsf.Name() != ttf.Name() {
4444
return false
4545
}
4646
done = true
4747
default:
4848
done = true
4949
}
5050
}
51-
if recurseStructs > 0 && !CanConvert(tsf, ttf, recurseStructs-1) {
52-
return false
53-
}
5451
}
5552
return true
5653
}

mirror_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestMirror(t *testing.T) {
3636
}
3737
for _, x := range tests {
3838
ta, tb := reflect.TypeOf(x.a), reflect.TypeOf(x.b)
39-
if x.ok != CanConvert(ta, tb, 0) {
39+
if x.ok != CanConvert(ta, tb) {
4040
if x.ok {
4141
t.Errorf("%s: could convert [%v] to [%v]\n",
4242
x.name, ta, tb)

0 commit comments

Comments
 (0)