Add wsl linter and fix

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-19 14:51:08 +04:00
parent eedfdcecc8
commit 9156d6a16a
882 changed files with 6068 additions and 574 deletions

View File

@@ -86,10 +86,12 @@ func NewServer(staticFiles fs.FS, distPath string, gzipOptions GzipOptions, opts
}
content := make([]byte, info.Size())
file, err := subFS.Open(path)
if err != nil {
return err
}
defer func() { _ = file.Close() }()
_, err = file.Read(content)
@@ -104,7 +106,6 @@ func NewServer(staticFiles fs.FS, distPath string, gzipOptions GzipOptions, opts
return nil
},
)
if err != nil {
return nil, fmt.Errorf("cannot generate etags: %w", err)
}
@@ -153,6 +154,7 @@ func (s *Server) serveIndex(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write(buf.Bytes())
return
}
@@ -200,6 +202,7 @@ func (s *Server) ServeSPA(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.WriteHeader(http.StatusOK)
_, _ = w.Write(buf.Bytes())
return
}
@@ -262,10 +265,12 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if s.shouldCompressWithGzip(r) {
w.Header().Set("Content-Encoding", "gzip")
gz := gzip.NewWriter(w)
defer func() { _ = gz.Close() }()
gzw := gzipResponseWriter{Writer: gz, ResponseWriter: w}
s.ServeSPA(gzw, r)
return
}