From 5c7226ae3444231e2da47cfaa0e1722cc74fcecc Mon Sep 17 00:00:00 2001 From: guangwu Date: Mon, 13 May 2024 16:50:11 +0800 Subject: [PATCH] fix: close resource --- dev/http.go | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/http.go b/dev/http.go index 7726719..2f8f61c 100644 --- a/dev/http.go +++ b/dev/http.go @@ -170,6 +170,7 @@ func (h *HTTPServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { fi, err := os.Stat(path) if err == nil && !fi.IsDir() { if ofile, err := os.Open(path); err == nil { + defer ofile.Close() http.ServeContent(w, req, req.URL.Path, fi.ModTime(), io.ReadSeeker(ofile)) return }