/
githubmirror
/
go
Обзор
Документация
Войти
/
githubmirror
/
go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/interface/fail.go
39 строк
544 B
Chris Manghane
cmd/gc: blank methods are not permitted in interface types
15 окт 2014, 20:55
15 окт 2014, 20:55
db4dad7
Код
Авторство
О чём код?
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test that interface conversion fails when method is missing. package main type I interface { Foo() } func main() { shouldPanic(p1) } func p1() { var s *S var i I var e interface{} e = s i = e.(I) _ = i } type S struct{} func (s *S) _() {} func shouldPanic(f func()) { defer func() { if recover() == nil { panic("function should panic") } }() f() }