Describe the bug
In main.go:3510-3525, the binary copy block opens two files and manually calls Close on every error path:
in, err := os.Open(binPath)
if err != nil { ... }
out, err := os.OpenFile(tmpNew, ...)
if err != nil { in.Close(); ... }
if _, err := io.Copy(out, in); err != nil { in.Close(); out.Close(); ... }
in.Close()
out.Close()
This is fragile — every future return needs the same dance. A close error is also discarded, masking failed flushes.
Expected behavior
Use defer for both files and report close errors (especially on out, where the close error is the only signal that pending data was actually flushed).
Describe the bug
In main.go:3510-3525, the binary copy block opens two files and manually calls
Closeon every error path:This is fragile — every future return needs the same dance. A close error is also discarded, masking failed flushes.
Expected behavior
Use
deferfor both files and report close errors (especially onout, where the close error is the only signal that pending data was actually flushed).