I am new to go programming, I just wrote a http server program based on the tutorial
here. The code is working fine in linux ( I am using linux mint 14 with go version 1.0.2). But when I demoed it to my friend in a mac machine with go version 1.1.2 it crashed while serving the request. My question is how do I debug these sort of errors, what tools can be used? Any articles on inspecting these sort of errors would be helpful. Also right now I have no idea how to fix this.
when running the code I am getting this error ( go version 1.1.2 mac os x 10.7.5)
2013/08/26 18:09:36 GET HTTP/1.1 /
2013/08/26 18:09:36 http: panic serving [::1]:59182: runtime error: invalid memory address or nil pointer dereference
goroutine 4 [running]:
net/http.func·007()
/usr/local/go/src/pkg/net/http/server.go:1022 +0x9c
main.handleRoute(0x18a368, 0x5, 0x11469de0, 0x11478400, 0x11475310, ...)
/Users/deepak/Work/Go/programs/server/server.go:61 +0x1c1
main.router(0x11469de0, 0x11478400, 0x11453850)
/Users/deepak/Work/Go/programs/server/server.go:69 +0x11a
net/http.HandlerFunc.ServeHTTP(0x1c80cc, 0x11469de0, 0x11478400, 0x11453850)
/usr/local/go/src/pkg/net/http/server.go:1149 +0x39
net/http.(*ServeMux).ServeHTTP(0x11469660, 0x11469de0, 0x11478400, 0x11453850)
/usr/local/go/src/pkg/net/http/server.go:1416 +0xda
net/http.serverHandler.ServeHTTP(0x1146d270, 0x11469de0, 0x11478400, 0x11453850)
/usr/local/go/src/pkg/net/http/server.go:1517 +0x11e
net/http.(*conn).serve(0x114722d0)
/usr/local/go/src/pkg/net/http/server.go:1096 +0x650
created by net/http.(*Server).Serve
/usr/local/go/src/pkg/net/http/server.go:1564 +0x23f
^[[A^[[A^Cexit status 2