Skip to content

Commit 85cd95a

Browse files
committed
Use dir walking from stdlib instead of godirwalk
1 parent 75f94cf commit 85cd95a

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

cmd/codeowners/main.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"strings"
88

99
"github.com/hmarr/codeowners"
10-
"github.com/karrick/godirwalk"
1110
flag "github.com/spf13/pflag"
1211
)
1312

@@ -60,19 +59,16 @@ func main() {
6059
continue
6160
}
6261

63-
err = godirwalk.Walk(startPath, &godirwalk.Options{
64-
Callback: func(path string, dirent *godirwalk.Dirent) error {
65-
if path == ".git" {
66-
return filepath.SkipDir
67-
}
68-
69-
// Only show code owners for files, not directories
70-
if !dirent.IsDir() {
71-
return printFileOwners(ruleset, path, ownerFilters, showUnowned)
72-
}
73-
return nil
74-
},
75-
Unsorted: true,
62+
err = filepath.WalkDir(startPath, func(path string, d os.DirEntry, err error) error {
63+
if path == ".git" {
64+
return filepath.SkipDir
65+
}
66+
67+
// Only show code owners for files, not directories
68+
if !d.IsDir() {
69+
return printFileOwners(ruleset, path, ownerFilters, showUnowned)
70+
}
71+
return nil
7672
})
7773

7874
if err != nil {

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module github.com/hmarr/codeowners
33
go 1.14
44

55
require (
6-
github.com/karrick/godirwalk v1.17.0
76
github.com/spf13/pflag v1.0.5
87
github.com/stretchr/testify v1.8.0
98
)

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4-
github.com/karrick/godirwalk v1.17.0 h1:b4kY7nqDdioR/6qnbHQyDvmA17u5G1cZ6J+CZXwSWoI=
5-
github.com/karrick/godirwalk v1.17.0/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
64
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
75
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
86
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=

0 commit comments

Comments
 (0)