我是Golang的新手,目前正在遵循本教程和源代码 –
http://golang.org/doc/articles/wiki/part2.go
构建此文件后,我得到了
calvin$./mywebwiki2 2012/07/23 17:12:59 http: panic serving [::1]:58820: runtime error: invalid memory address or nil pointer dereference /usr/local/go/src/pkg/net/http/server.go:576 (0x3f202) _func_003: buf.Write(debug.Stack()) /private/tmp/bindist454984655/go/src/pkg/runtime/proc.c:1443 (0x10c79) /private/tmp/bindist454984655/go/src/pkg/runtime/runtime.c:128 (0x11745) /private/tmp/bindist454984655/go/src/pkg/runtime/thread_darwin.c:418 (0x148b5) /Users/calvin/work/gowiki/mywebwiki2.go:33 (0x2248) viewHandler: fmt.Fprintf(w,"<h1>%s</h1><div>%s</div>",p.Title,p.Body) /usr/local/go/src/pkg/net/http/server.go:690 (0x331ae) HandlerFunc.ServeHTTP: f(w,r) /usr/local/go/src/pkg/net/http/server.go:926 (0x34030) (*ServeMux).ServeHTTP: mux.handler(r).ServeHTTP(w,r) /usr/local/go/src/pkg/net/http/server.go:656 (0x32fc1) (*conn).serve: handler.ServeHTTP(w,w.req) /private/tmp/bindist454984655/go/src/pkg/runtime/proc.c:271 (0xed7f) 2012/07/23 17:12:59 http: panic serving [::1]:58821: runtime error: invalid memory address or nil pointer dereference
知道我做错了导致这种明显的内存损坏吗?