Skip to content

Commit

Permalink
Fix lll linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bodgit committed Apr 30, 2022
1 parent 943eae4 commit 5094747
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions register.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ type Decompressor func([]byte, uint64, []io.ReadCloser) (io.ReadCloser, error)

var decompressors sync.Map

func newCopyReader(_ []byte, _ uint64, readers []io.ReadCloser) (io.ReadCloser, error) {
if len(readers) != 1 {
return nil, errors.New("sevenzip: need exactly one reader")
}
// just return the passed io.ReadCloser)
return readers[0], nil
}

func init() {
// Copy (just return the passed io.ReadCloser)
RegisterDecompressor([]byte{0x00}, Decompressor(func(_ []byte, _ uint64, readers []io.ReadCloser) (io.ReadCloser, error) {
if len(readers) != 1 {
return nil, errors.New("sevenzip: need exactly one reader")
}
return readers[0], nil
}))
// Copy
RegisterDecompressor([]byte{0x00}, Decompressor(newCopyReader))
// Delta
RegisterDecompressor([]byte{0x03}, Decompressor(delta.NewReader))
// LZMA
Expand Down

0 comments on commit 5094747

Please sign in to comment.