Checking for methodset existance

This commit is contained in:
Marco Manino
2024-02-13 17:48:19 +01:00
committed by Ayke
parent 1d9f26cee1
commit cef2a82c97
2 changed files with 15 additions and 0 deletions
+11
View File
@@ -109,3 +109,14 @@ func sliceString(s string, start, end int) string {
func sliceSlice(s []int, start, end int) []int {
return s[start:end]
}
type outside struct{}
func init() {
_, _ = any(0).(interface{ DoesNotExist() })
_, _ = any("").(interface{ DoesNotExist() })
_, _ = any(outside{}).(interface{ DoesNotExist() })
type inside struct{}
_, _ = any(inside{}).(interface{ DoesNotExist() })
}