title: HTTP Static file handler keeps showing the directory list
body: <p>When I implement a static server handler, if I access to root path, it will show the whole directory, like this:</p>
  
  <p><a href="https://i.stack.imgur.com/twmYb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/twmYb.png" alt="access to root folder"></a></p>
  
  <p>My code is:</p>
  
  <pre><code>package main
  
  import (
      "flag"
      "log"
      "net/http"
      "strings"
  )
  
  func main() {
      port := flag.String("p", "3000", "port to serve on")
      directory := flag.String("d", ".", "the directory of static file to host")
      flag.Parse()
  
      http.Handle("/statics/", http.StripPrefix(strings.TrimRight("/statics/", "/"), http.FileServer(http.Dir(*directory))))
  
      log.Printf("Serving %s on HTTP port: %s\n", *directory, *port)
      log.Fatal(http.ListenAndServe(":"+*port, nil))
  }
  </code></pre>
  
  <p>go to : <a href="http://locahost:3000/statics/" rel="nofollow noreferrer">http://locahost:3000/statics/</a></p>