Skip to content

Commit b2d22d9

Browse files
committed
use IsDir() in favour of bit mask
1 parent 622e346 commit b2d22d9

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

‎internal/deb/extract_test.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package deb_test
22

33
import (
44
"bytes"
5-
"io/fs"
65
"path/filepath"
76
"sort"
87
"strings"
@@ -333,7 +332,7 @@ func (s *S) TestExtract(c *C) {
333332
createdPaths := make(map[string]bool)
334333
options.Create = func(_ *deb.ExtractInfo, o *fsutil.CreateOptions) error {
335334
relPath := filepath.Clean("/" + strings.TrimPrefix(o.Path, dir))
336-
if o.Mode&fs.ModeDir != 0 {
335+
if o.Mode.IsDir() {
337336
relPath = relPath + "/"
338337
}
339338
createdPaths[relPath] = true

‎internal/slicer/report.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (r *Report) Add(slice *setup.Slice, fsEntry *fsutil.Entry) error {
4242
return fmt.Errorf("cannot add path %q outside of root %q", fsEntry.Path, r.Root)
4343
}
4444
relPath := filepath.Clean("/" + strings.TrimPrefix(fsEntry.Path, r.Root))
45-
if fsEntry.Mode&fs.ModeDir != 0 {
45+
if fsEntry.Mode.IsDir() {
4646
relPath = relPath + "/"
4747
}
4848

‎internal/slicer/slicer.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"bytes"
66
"fmt"
77
"io"
8-
"io/fs"
98
"os"
109
"path/filepath"
1110
"strings"
@@ -175,7 +174,7 @@ func Run(options *RunOptions) (*Report, error) {
175174
// Check whether the file was created because it matched a glob.
176175
if strings.ContainsAny(extractInfo.Path, "*?") {
177176
relPath := filepath.Clean("/" + strings.TrimLeft(o.Path, targetDir))
178-
if o.Mode&fs.ModeDir != 0 {
177+
if o.Mode.IsDir() {
179178
relPath = relPath + "/"
180179
}
181180
globbedPaths[extractInfo.Path] = append(globbedPaths[extractInfo.Path], relPath)

0 commit comments

Comments
 (0)