Skip to content

Commit

Permalink
fix: fixed sonar warns
Browse files Browse the repository at this point in the history
  • Loading branch information
wwoytenko committed Dec 7, 2024
1 parent d6f2e72 commit 1d07342
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions internal/db/postgres/restorers/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,6 @@ import (
"github.com/greenmaskio/greenmask/internal/utils/ioutils"
)

type GzipObjectWrapper struct {
gz io.ReadCloser
r io.ReadCloser
}

func NewGzipObjectWrapper(r io.ReadCloser, usePgzip bool) (*GzipObjectWrapper, error) {
gz, err := ioutils.GetGzipReadCloser(r, usePgzip)
if err != nil {
if err := r.Close(); err != nil {
log.Warn().
Err(err).
Msg("error closing dump file")
}
return nil, fmt.Errorf("cannot create gzip reader: %w", err)
}

return &GzipObjectWrapper{
gz: gz,
r: r,
}, nil

}

func (o *GzipObjectWrapper) Read(p []byte) (n int, err error) {
return o.gz.Read(p)
}

func (o *GzipObjectWrapper) Close() error {
if err := o.gz.Close(); err != nil {
log.Warn().
Err(err).
Msg("error closing gzip reader")
}
if err := o.r.Close(); err != nil {
log.Warn().
Err(err).
Msg("error closing dump file")
}
return nil
}

type restoreBase struct {
opt *pgrestore.DataSectionSettings
entry *toc.Entry
Expand Down

0 comments on commit 1d07342

Please sign in to comment.