Skip to content

Commit 767a6b3

Browse files
committed
fix: check zip writer Close error in serveFoundryModuleZip
Fixes errcheck lint failure — zw.Close() must be checked since it flushes the zip central directory to the response. https://claude.ai/code/session_01XMwxFR8BCi5XvgaSVMSBZB
1 parent 269f359 commit 767a6b3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

internal/app/app.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,8 @@ func (a *App) serveFoundryModuleZip(c echo.Context) error {
317317
c.Response().WriteHeader(http.StatusOK)
318318

319319
zw := zip.NewWriter(c.Response().Writer)
320-
defer zw.Close()
321320

322-
return filepath.WalkDir(moduleDir, func(path string, d fs.DirEntry, err error) error {
321+
walkErr := filepath.WalkDir(moduleDir, func(path string, d fs.DirEntry, err error) error {
323322
if err != nil {
324323
return err
325324
}
@@ -347,6 +346,10 @@ func (a *App) serveFoundryModuleZip(c echo.Context) error {
347346
_, err = w.Write(data)
348347
return err
349348
})
349+
if walkErr != nil {
350+
return walkErr
351+
}
352+
return zw.Close()
350353
}
351354

352355
// Start begins listening for HTTP requests on the configured port.

0 commit comments

Comments
 (0)