Commits

Miki Tebeka committed ee7b1c7

close in defer

  • Participants
  • Parent commits b47d4d7

Comments (0)

Files changed (1)

 		message := fmt.Sprintf("can't open %s - %s", rsc.Name(), err)
 		http.Error(w, message, http.StatusInternalServerError)
 	}
+	defer rdr.Close()
 
 	mtype := mime.TypeByExtension(filepath.Ext(req.URL.Path))
 	if len(mtype) != 0 {
 	w.Header().Set("Last-Modified", rsc.ModTime().UTC().Format(http.TimeFormat))
 
 	io.Copy(w, rdr)
-	rdr.Close()
 }
 
 // Get returns the named resource (nil if not found)