diff --git a/core/logx/rotatelogger.go b/core/logx/rotatelogger.go index 42d84b1c..1b480eb4 100644 --- a/core/logx/rotatelogger.go +++ b/core/logx/rotatelogger.go @@ -426,7 +426,6 @@ func gzipFile(file string) error { if err != nil { return err } - defer in.Close() out, err := os.Create(fmt.Sprintf("%s%s", file, gzipExt)) if err != nil { @@ -441,5 +440,7 @@ func gzipFile(file string) error { return err } + in.Close() + return os.Remove(file) }