Skip to content

Commit

Permalink
refactor: rename err1 variables
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Mar 19, 2024
1 parent 222c0bf commit 31f6eac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
24 changes: 12 additions & 12 deletions fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1427,22 +1427,22 @@ func (h *fsHandler) compressFileNolock(
case "br":
zw := acquireStacklessBrotliWriter(zf, CompressDefaultCompression)
_, err = copyZeroAlloc(zw, f)
if err1 := zw.Flush(); err == nil {
err = err1
if errf := zw.Flush(); err == nil {
err = errf
}
releaseStacklessBrotliWriter(zw, CompressDefaultCompression)
case "gzip":
zw := acquireStacklessGzipWriter(zf, CompressDefaultCompression)
_, err = copyZeroAlloc(zw, f)
if err1 := zw.Flush(); err == nil {
err = err1
if errf := zw.Flush(); err == nil {
err = errf
}
releaseStacklessGzipWriter(zw, CompressDefaultCompression)
case "zstd":
zw := acquireStacklessZstdWriter(zf, CompressZstdDefault)
_, err = copyZeroAlloc(zw, f)
if err1 := zw.Flush(); err == nil {
err = err1
if errf := zw.Flush(); err == nil {
err = errf
}
releaseStacklessZstdWriter(zw, CompressZstdDefault)
}
Expand Down Expand Up @@ -1472,22 +1472,22 @@ func (h *fsHandler) newCompressedFSFileCache(f fs.File, fileInfo fs.FileInfo, fi
case "br":
zw := acquireStacklessBrotliWriter(w, CompressDefaultCompression)
_, err = copyZeroAlloc(zw, f)
if err1 := zw.Flush(); err == nil {
err = err1
if errf := zw.Flush(); err == nil {
err = errf
}
releaseStacklessBrotliWriter(zw, CompressDefaultCompression)
case "gzip":
zw := acquireStacklessGzipWriter(w, CompressDefaultCompression)
_, err = copyZeroAlloc(zw, f)
if err1 := zw.Flush(); err == nil {
err = err1
if errf := zw.Flush(); err == nil {
err = errf
}
releaseStacklessGzipWriter(zw, CompressDefaultCompression)
case "zstd":
zw := acquireStacklessZstdWriter(w, CompressZstdDefault)
_, err = copyZeroAlloc(zw, f)
if err1 := zw.Flush(); err == nil {
err = err1
if errf := zw.Flush(); err == nil {
err = errf
}
releaseStacklessZstdWriter(zw, CompressZstdDefault)
}
Expand Down
16 changes: 8 additions & 8 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -1500,15 +1500,15 @@ func (resp *Response) WriteTo(w io.Writer) (int64, error) {
func writeBufio(hw httpWriter, w io.Writer) (int64, error) {
sw := acquireStatsWriter(w)
bw := acquireBufioWriter(sw)
err1 := hw.Write(bw)
err2 := bw.Flush()
errw := hw.Write(bw)
errf := bw.Flush()
releaseBufioWriter(bw)
n := sw.bytesWritten
releaseStatsWriter(sw)

err := err1
err := errw
if err == nil {
err = err2
err = errf
}
return n, err
}
Expand Down Expand Up @@ -2004,9 +2004,9 @@ func (req *Request) writeBodyStream(w *bufio.Writer) error {
err = req.Header.writeTrailer(w)
}
}
err1 := req.closeBodyStream()
errc := req.closeBodyStream()
if err == nil {
err = err1
err = errc
}
return err
}
Expand Down Expand Up @@ -2061,9 +2061,9 @@ func (resp *Response) writeBodyStream(w *bufio.Writer, sendBody bool) (err error
}
}
}
err1 := resp.closeBodyStream()
errc := resp.closeBodyStream()
if err == nil {
err = err1
err = errc
}
return err
}
Expand Down
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2044,10 +2044,10 @@ func (s *Server) ServeConn(c net.Conn) error {
atomic.AddUint32(&s.concurrency, ^uint32(0))

if err != errHijacked {
err1 := c.Close()
errc := c.Close()
s.setState(c, StateClosed)
if err == nil {
err = err1
err = errc
}
} else {
err = nil
Expand Down

0 comments on commit 31f6eac

Please sign in to comment.