diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index bb4592b332..b0a2608afb 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -2372,12 +2372,14 @@ type unexp struct{} func (*unexp) f() (int32, int8) { return 7, 7 } func (*unexp) g() (int64, int8) { return 8, 8 } -func TestUnexportedMethods(t *testing.T) { - _ = (interface { - f() (int32, int8) - })(new(unexp)) +type unexpI interface { + f() (int32, int8) +} - typ := TypeOf(new(unexp)) +var unexpi unexpI = new(unexp) + +func TestUnexportedMethods(t *testing.T) { + typ := TypeOf(unexpi) if typ.Method(0).Type == nil { t.Error("missing type for satisfied method 'f'")