From 28a69aef9f4e2c12e5d059a256ca5dd580f50a2b Mon Sep 17 00:00:00 2001 From: "Ariel Shaqed (Scolnicov)" Date: Wed, 24 Mar 2021 15:40:07 +0200 Subject: [PATCH] [CR] Clean up deleteOnClose and clarify Close implementation comment --- cmd/lakectl/cmd/input.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cmd/lakectl/cmd/input.go b/cmd/lakectl/cmd/input.go index 93533123d65..e106021f9c6 100644 --- a/cmd/lakectl/cmd/input.go +++ b/cmd/lakectl/cmd/input.go @@ -61,17 +61,9 @@ type deleteOnClose struct { *os.File } -func (d *deleteOnClose) Read(p []byte) (n int, err error) { - return d.File.Read(p) -} - -func (d *deleteOnClose) Seek(offset int64, whence int) (int64, error) { - return d.File.Seek(offset, whence) -} - func (d *deleteOnClose) Close() error { if err := os.Remove(d.Name()); err != nil { - d.File.Close() // Close failure is unimportant on read, but data definitely stays! + d.File.Close() // "Only" file descriptor leak if close fails (but data might stay). return fmt.Errorf("delete on close: %w", err) } return d.File.Close()