On Friday, 17 October 2014 01:58:22 UTC+11, varding wrote:
> ... when I run it ,windows popup a dialog indicate that the exe is stopped,and there is no other information display in the console
There were improvements made in Go runtime on "information display in the console" front recently. If you do your exercise on the tip, you will get stack trace instead. Like that:
C:\go\path\src\t>foo.exe
Exception 0xc0000005 0x8 0x6c3180 0x6c3180
PC=0x6c3180
signal arrived during cgo execution
database/sql.(*DB).conn(0xc08204e000, 0x401217, 0x0, 0x0)
c:/go/root/src/database/sql/sql.go:659 +0x7df
database/sql.(*DB).Ping(0xc08204e000, 0x0, 0x0)
c:/go/root/src/database/sql/sql.go:457 +0x4f
main.main()
C:/go/path/src/t/foo.go:17 +0x230
goroutine 2 [runnable]:
runtime.forcegchelper()
c:/go/root/src/runtime/proc.go:90
runtime.goexit()
c:/go/root/src/runtime/proc.c:1651
goroutine 3 [runnable]:
runtime.bgsweep()
c:/go/root/src/runtime/mgc0.go:66
runtime.goexit()
c:/go/root/src/runtime/proc.c:1651
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
c:/go/root/src/runtime/proc.c:1651
goroutine 4 [runnable]:
runtime.runfinq()
c:/go/root/src/runtime/malloc.go:705
runtime.goexit()
c:/go/root/src/runtime/proc.c:1651
goroutine 5 [runnable]:
database/sql.(*DB).connectionOpener(0xc08204e000)
c:/go/root/src/database/sql/sql.go:583
created by database/sql.Open
c:/go/root/src/database/sql/sql.go:447 +0x41a
rax 0x0
rbx 0x7
rcx 0x6ce4c0
rdx 0x6ce4c0
rdi 0x6ce4f0
rsi 0x6d2ec0
rbp 0x6ce7c0
rsp 0x22fd48
r8 0x2
r9 0x84
r10 0x42
r11 0x1330158
r12 0xc08201faf0
r13 0x1084d60
r14 0xc082016000
r15 0xc082008100
rip 0x6c3180
rflags 0x10246
cs 0x33
fs 0x53
gs 0x2b
I hope it helps.
Alex