go text/template html/template invalid memory address or nil pointer dereference

來源:互聯網
上載者:User

標籤:com   efi   guid   error   check   poi   mem   text   ted   

2017/08/14 20:06:10 http: panic serving 172.22.27.131:56324: runtime error: invalid memory address or nil pointer dereferencegoroutine 19 [running]:net/http.(*conn).serve.func1(0xc420171e00)        /usr/local/go/src/net/http/server.go:1693 +0xd0panic(0x7d84a0, 0xa6d910)        /usr/local/go/src/runtime/panic.go:491 +0x283html/template.(*Template).checkCanParse(0xc4202e80f0, 0x0, 0x0)        /usr/local/go/src/html/template/template.go:84 +0x45html/template.parseFiles(0xc4202e80f0, 0xc420011250, 0x1, 0x1, 0x7b87c0, 0xc420014b01, 0xc420011250)        /usr/local/go/src/html/template/template.go:396 +0x40html/template.(*Template).ParseFiles(0xc4202e80f0, 0xc420011250, 0x1, 0x1, 0xd, 0xc420041a88, 0x60c3b2)        /usr/local/go/src/html/template/template.go:390 +0x49managerNet.listGuidance(0xa41ca0, 0xc4202ea000, 0xc4201ec300)        /home/ubuntu/mew/mew_manager/src/managerNet/listGuidance.go:11 +0xa8net/http.HandlerFunc.ServeHTTP(0x864fc8, 0xa41ca0, 0xc4202ea000, 0xc4201ec300)        /usr/local/go/src/net/http/server.go:1914 +0x44mewNet.Logger.func1(0xa41ca0, 0xc4202ea000, 0xc4201ec300)        /home/ubuntu/mew/mew_server/src/mewNet/logger.go:38 +0x1a7net/http.HandlerFunc.ServeHTTP(0xc42007dbc0, 0xa41ca0, 0xc4202ea000, 0xc4201ec300)        /usr/local/go/src/net/http/server.go:1914 +0x44github.com/gorilla/mux.(*Router).ServeHTTP(0xc420088320, 0xa41ca0, 0xc4202ea000, 0xc4201ec300)        /home/ubuntu/go/src/github.com/gorilla/mux/mux.go:114 +0xdcnet/http.serverHandler.ServeHTTP(0xc42007f5f0, 0xa41ca0, 0xc4202ea000, 0xc4201ec100)        /usr/local/go/src/net/http/server.go:2610 +0xb4net/http.(*conn).serve(0xc420171e00, 0xa42360, 0xc42005c300)        /usr/local/go/src/net/http/server.go:1797 +0x71dcreated by net/http.(*Server).Serve        /usr/local/go/src/net/http/server.go:2711 +0x288

將html/template 的 *template.Template來 PaseFiles

  tmpl := &template.Template{}  tmpl, err := tmpl.ParseFiles("view/guidance.html")原來是想用text/template 的 參考自近期遇到的3個Golang代碼問題

go text/template html/template invalid memory address or nil pointer dereference

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.