Re:Go 1.7.1 Released
by travjones on Wednesday September 07, 2016 @05:57PM
(#12448207)
I think it would produce a runtime error and return a stack trace. Someone more qualified than me should chime in though...
[ Parent
| on HN ]
Re:Go 1.7.1 Released
by justinsaccount on Wednesday September 07, 2016 @06:48PM
(#12448649)
Yes, like this:
package main
import "io"
func main() {
var foo io.Closer
foo.Close()
}
justin@t420:/tmp$ go run nil.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x401023]
goroutine 1 [running]:
panic(0x463ea0, 0xc82000a140)
/usr/lib/go-1.6/src/runtime/panic.go:481 +0x3e6
main.main()
/tmp/nil.go:7 +0x23
exit status 2