title: golang error when serving static files
body: <p>I can't figure out this error in go lang when executing a template</p>
  
  <pre><code>panic: open templates/*.html: The system cannot find the path specified.
  </code></pre>
  
  <p>another problem is that my public folder can't be served from css and I don't know why.</p>
  
  <p>code:</p>
  
  <pre><code>package main
  
  import (
      "net/http"
      "github.com/gorilla/mux"
      "html/template"
      "log"
  )
  
  var tpl *template.Template
  
  func init() {
      tpl = template.Must(template.ParseGlob("templates/*.html"))
  }
  
  func main() {
      r := mux.NewRouter()
      r.HandleFunc("/",home)
      http.Handle("/public/", http.StripPrefix("/public/", 
      http.FileServer(http.Dir("/pub"))))
      http.ListenAndServe(":8080", r)
  }
  
  func home(writer http.ResponseWriter, request *http.Request) {
      err := tpl.ExecuteTemplate(writer, "index.html", nil)
      if err != nil {
          log.Println(err)
          http.Error(writer, "Internal server error", http.StatusInternalServerError)
      }
  }
  </code></pre>
  
  <p>my folder is like that:</p>
  
  <pre>bin
  pkg
  pub
     css
       home.css
     js
  src
     github.com
          gorila/mux
  templates
          index.html</pre>
  
  <p>my GOROOT is pointing to the folder <code>project</code> which contains the <code>bin</code> <code>pkg</code> <code>src</code> </p>
  
  <p>when I make the <code>templates</code> folder outside <code>src</code> it works fine but I thinks that's not right everything must be in <code>src</code> right ?</p>
  
  <p>index.html</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;test&lt;/title&gt;
      &lt;link href="../public/css/home.css" type="text/css" rel="stylesheet" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;welcome! hi&lt;/h1&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>here i can't serve the css</p>
  
  <p><strong>UPDATE::</strong></p>
  
  <p>the first problem is solved of the templates folder .</p>
  
  <p>but I am still cannot solve the second issue</p>