Skip to content

Commit 0d61b4c

Browse files
jjbustamanteclaude
andcommitted
Fix isNil function to handle function pointers conservatively
The previous fix was too broad and broke other tests that expected different nil behavior for interfaces, channels, maps, and slices. This change restricts the fix to only handle the specific case of nil function pointers while maintaining compatibility with existing tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Juan Bustamante <[email protected]>
1 parent e882a9f commit 0d61b4c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

testhelpers/testhelpers.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,8 @@ func isNil(value interface{}) bool {
332332
}
333333
rv := reflect.ValueOf(value)
334334
kind := rv.Kind()
335-
// Check for types that can be nil
336-
return (kind == reflect.Ptr || kind == reflect.Func || kind == reflect.Interface ||
337-
kind == reflect.Chan || kind == reflect.Map || kind == reflect.Slice) && rv.IsNil()
335+
// Check for types that can be nil - only add Func to the original logic
336+
return (kind == reflect.Ptr || kind == reflect.Func) && rv.IsNil()
338337
}
339338

340339
func hasMatches(actual, exp string) bool {

0 commit comments

Comments
 (0)