mirror of
https://github.com/golang/go
synced 2024-11-23 10:40:08 -07:00
a97a91de06
Fixes bug 6055. R=golang-dev, bradfitz, dvyukov, khr CC=golang-dev https://golang.org/cl/12536045
30 lines
448 B
Go
30 lines
448 B
Go
// run
|
|
|
|
// Copyright 2013 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.
|
|
|
|
package main
|
|
|
|
type Closer interface {
|
|
Close()
|
|
}
|
|
|
|
func nilInterfaceDeferCall() {
|
|
var x Closer
|
|
defer x.Close()
|
|
}
|
|
|
|
func shouldPanic(f func()) {
|
|
defer func() {
|
|
if recover() == nil {
|
|
panic("did not panic")
|
|
}
|
|
}()
|
|
f()
|
|
}
|
|
|
|
func main() {
|
|
shouldPanic(nilInterfaceDeferCall)
|
|
}
|