zoukankan      html  css  js  c++  java
  • go text/template html/template invalid memory address or nil pointer dereference

    2017/08/14 20:06:10 http: panic serving 172.22.27.131:56324: runtime error: invalid memory address or nil pointer dereference
    goroutine 19 [running]:
    net/http.(*conn).serve.func1(0xc420171e00)
            /usr/local/go/src/net/http/server.go:1693 +0xd0
    panic(0x7d84a0, 0xa6d910)
            /usr/local/go/src/runtime/panic.go:491 +0x283
    html/template.(*Template).checkCanParse(0xc4202e80f0, 0x0, 0x0)
            /usr/local/go/src/html/template/template.go:84 +0x45
    html/template.parseFiles(0xc4202e80f0, 0xc420011250, 0x1, 0x1, 0x7b87c0, 0xc420014b01, 0xc420011250)
            /usr/local/go/src/html/template/template.go:396 +0x40
    html/template.(*Template).ParseFiles(0xc4202e80f0, 0xc420011250, 0x1, 0x1, 0xd, 0xc420041a88, 0x60c3b2)
            /usr/local/go/src/html/template/template.go:390 +0x49
    managerNet.listGuidance(0xa41ca0, 0xc4202ea000, 0xc4201ec300)
            /home/ubuntu/mew/mew_manager/src/managerNet/listGuidance.go:11 +0xa8
    net/http.HandlerFunc.ServeHTTP(0x864fc8, 0xa41ca0, 0xc4202ea000, 0xc4201ec300)
            /usr/local/go/src/net/http/server.go:1914 +0x44
    mewNet.Logger.func1(0xa41ca0, 0xc4202ea000, 0xc4201ec300)
            /home/ubuntu/mew/mew_server/src/mewNet/logger.go:38 +0x1a7
    net/http.HandlerFunc.ServeHTTP(0xc42007dbc0, 0xa41ca0, 0xc4202ea000, 0xc4201ec300)
            /usr/local/go/src/net/http/server.go:1914 +0x44
    github.com/gorilla/mux.(*Router).ServeHTTP(0xc420088320, 0xa41ca0, 0xc4202ea000, 0xc4201ec300)
            /home/ubuntu/go/src/github.com/gorilla/mux/mux.go:114 +0xdc
    net/http.serverHandler.ServeHTTP(0xc42007f5f0, 0xa41ca0, 0xc4202ea000, 0xc4201ec100)
            /usr/local/go/src/net/http/server.go:2610 +0xb4
    net/http.(*conn).serve(0xc420171e00, 0xa42360, 0xc42005c300)
            /usr/local/go/src/net/http/server.go:1797 +0x71d
    created 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 的
     
  • 相关阅读:
    Sql server char,nchar,varchar与Nvarchar的区别
    关于sysprocesses表各字段的作用
    多台子服务器更新中央服务器
    [转自MSDN]根据FxCop整理的.NET代码编写规范
    【原】Winfrom的自动更新模块
    Silverlight 3和Expression 3将于7月10日发布
    【转蝈蝈俊.net 】SQL Server 2005 配置发送邮件
    WF4.0 RC 官方示例
    [转]Ubuntu Server下如何安装图形界面?
    [原]linux下如何查看本机IP,gateway,DNS
  • 原文地址:https://www.cnblogs.com/cdyboke/p/7359999.html
Copyright © 2011-2022 走看看