Skip to content

Commit

Permalink
style: Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bodgit committed Apr 1, 2024
1 parent 9ab8459 commit c6947f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/zstd/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func NewReader(_ []byte, _ uint64, readers []io.ReadCloser) (io.ReadCloser, erro
if r, err = zstd.NewReader(readers[0]); err != nil {
return nil, err
}

runtime.SetFinalizer(r, (*zstd.Decoder).Close)
}

Expand Down
4 changes: 3 additions & 1 deletion reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ func toValidName(name string) string {
return p
}

//nolint:cyclop
//nolint:cyclop,funlen
func (z *Reader) initFileList() {
z.fileListOnce.Do(func() {
files := make(map[string]int)
Expand Down Expand Up @@ -583,12 +583,14 @@ func (z *Reader) initFileList() {
isDir: isDir,
}
z.fileList = append(z.fileList, entry)

if isDir {
knownDirs[name] = idx
} else {
files[name] = idx
}
}

for dir := range dirs {
if _, ok := knownDirs[dir]; !ok {
if idx, ok := files[dir]; ok {
Expand Down
2 changes: 2 additions & 0 deletions reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ func TestOpenReader(t *testing.T) {

t.Run(table.name, func(t *testing.T) {
t.Parallel()

r, err := sevenzip.OpenReader(filepath.Join("testdata", table.file))
if err != nil {
assert.ErrorIs(t, err, table.err)
Expand Down Expand Up @@ -243,6 +244,7 @@ func TestOpenReaderWithPassword(t *testing.T) {

t.Run(table.name, func(t *testing.T) {
t.Parallel()

r, err := sevenzip.OpenReaderWithPassword(filepath.Join("testdata", table.file), table.password)
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit c6947f5

Please sign in to comment.