title: template.Execute(): invalid memory address or nil pointer dereference
body: <p>I am trying to use Go html/template with custom delimiters.</p>
  
  <p>However, I can Parse and Execute my "index.html" file, whenever I am trying to change my templates Delimiters I face the following error:</p>
  
  <pre><code>runtime error: invalid memory address or nil pointer dereference goroutine
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>package main
  
  import (
          "html/template"
          "net/http"
  )
  
  var sherrifTmpl = template.New("test").Delims("{[{", "}]}")
  
  func serveHome(w http.ResponseWriter, r *http.Request) {
          template.Must(sherrifTmpl.ParseFiles("index.html")).Execute(w, r)
  }
  </code></pre>
  
  <p>If I try any of the followings:</p>
  
  <pre><code>package main
  
  import (
          "html/template"
          "net/http"
  )
  
  func serveHome(w http.ResponseWriter, r *http.Request) {
          template.Must(template.ParseFiles("index.html")).Execute(w, r)
  }
  </code></pre>
  
  <p>Or:</p>
  
  <pre><code>package main
  
  import (
          "html/template"
          "net/http"
  )
  
  var sherrifTmpl = template.New("test").Delims("{[{", "}]}")
  
  func serveHome(w http.ResponseWriter, r *http.Request) {
          template.Must(sherrifTmpl.ParseFiles("{[{.Host}]}")).Execute(w, r)
  }
  </code></pre>
  
  <p>Everything works. I even tried to catch ParseFiles error. But still no luck:</p>
  
  <pre><code>package main
  
  import (
          "html/template"
          "net/http"
  )
  
  var sherrifTmpl = template.New("test").Delims("{[{", "}]}")
  
  func serveHome(w http.ResponseWriter, r *http.Request) {
          homeTmpl, err := sherrifTmpl.ParseFiles("index.html")
          if err != nil {
              panic(err)
          }
          homeTmpl.Execute(w, r)
  }
  </code></pre>
  
  <p>I can't see where I am doing wrong. I would be grateful if any of you could help me on this issue.</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>Here is the panic:</p>
  
  <pre><code>2015/04/13 17:43:35 http: panic serving 127.0.0.1:56634: runtime error: invalid memory address or nil pointer dereference
  goroutine 5 [running]:
  net/http.func·011()
      /usr/local/go/src/net/http/server.go:1130 +0xbb
  html/template.(*Template).escape(0xc20803ad80, 0x0, 0x0)
      /usr/local/go/src/html/template/template.go:59 +0xe4
  html/template.(*Template).Execute(0xc20803ad80, 0x7f550e16f420, 0xc20805cd20, 0x7280c0, 0xc208032ea0, 0x0, 0x0)
      /usr/local/go/src/html/template/template.go:75 +0x3d
  main.serveHome(0x7f550e16f328, 0xc20805cd20, 0xc208032ea0)
      /home/sasan/Works/Karina/Mobazi/Mon-Panel/routes.go:11 +0x136
  net/http.HandlerFunc.ServeHTTP(0x7eb738, 0x7f550e16f328, 0xc20805cd20, 0xc208032ea0)
      /usr/local/go/src/net/http/server.go:1265 +0x41
  net/http.(*ServeMux).ServeHTTP(0xc20803a6c0, 0x7f550e16f328, 0xc20805cd20, 0xc208032ea0)
      /usr/local/go/src/net/http/server.go:1541 +0x17d
  net/http.serverHandler.ServeHTTP(0xc20805a0c0, 0x7f550e16f328, 0xc20805cd20, 0xc208032ea0)
      /usr/local/go/src/net/http/server.go:1703 +0x19a
  net/http.(*conn).serve(0xc20805cc80)
      /usr/local/go/src/net/http/server.go:1204 +0xb57
  created by net/http.(*Server).Serve
      /usr/local/go/src/net/http/server.go:1751 +0x35e
  </code></pre>