Skip to content

Commit d01d615

Browse files
committed
chore: Address review comments
Signed-off-by: Kemal Akkoyun <[email protected]>
1 parent 5b1896f commit d01d615

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

internal/injector/typed/typecheck.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ func validateTypeNameIsInterface(obj types.Object, fullName string, pkgPath stri
112112
return nil, fmt.Errorf("type %s is not an interface", fullName)
113113
}
114114

115-
// Use .Underlying() to get the *types.Interface.
116-
iface, ok := typ.Underlying().(*types.Interface)
117-
if !ok {
118-
// This should ideally not happen if types.IsInterface passed, but check defensively.
119-
return nil, fmt.Errorf("type %s is an interface but failed to get underlying *types.Interface", fullName)
120-
}
121-
122-
return iface, nil
115+
// Since types.IsInterface passed, we can safely cast typ.Underlying() to *types.Interface
116+
return typ.Underlying().(*types.Interface), nil
123117
}

0 commit comments

Comments
 (0)