Skip to content

Commit f1df22a

Browse files
author
Arnold Trakhtenberg
authored
Fix directory ignores on windows (#128)
* Fix directory ignores on windows * go mod tidy * use filepath.ToSlash * back to reality
1 parent 8fb6600 commit f1df22a

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ require (
88
github.com/launchdarkly/api-client-go v0.0.0-20181031211650-fe4f1d017b6e
99
github.com/launchdarkly/json-patch v0.0.0-20180720210516-dd68d883319f
1010
github.com/mattn/go-runewidth v0.0.4 // indirect
11-
github.com/monochromegane/go-gitignore v0.0.0-20160105113617-38717d0a108c
11+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00
1212
github.com/olekukonko/tablewriter v0.0.1
1313
github.com/spf13/cobra v1.0.0
1414
github.com/spf13/pflag v1.0.5
1515
github.com/spf13/viper v1.6.3
1616
github.com/stretchr/testify v1.3.0
1717
golang.org/x/oauth2 v0.0.0-20181120190819-8f65e3013eba // indirect
18-
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
1918
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384
2019
google.golang.org/appengine v1.3.0 // indirect
2120
gopkg.in/yaml.v2 v2.2.8 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh
8787
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
8888
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
8989
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
90-
github.com/monochromegane/go-gitignore v0.0.0-20160105113617-38717d0a108c h1:RRUev95N3Gq4Aog4avFzXJA2V8fgXmND+cvcH7KLMyk=
91-
github.com/monochromegane/go-gitignore v0.0.0-20160105113617-38717d0a108c/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
90+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0=
91+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
9292
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
9393
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
9494
github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88=

internal/search/files.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import (
88
"path/filepath"
99
"strings"
1010

11-
"github.com/launchdarkly/ld-find-code-refs/internal/validation"
1211
"github.com/monochromegane/go-gitignore"
1312
"golang.org/x/tools/godoc/util"
13+
14+
"github.com/launchdarkly/ld-find-code-refs/internal/validation"
1415
)
1516

1617
type ignore struct {
@@ -67,6 +68,7 @@ func readFiles(ctx context.Context, files chan<- file, workspace string) error {
6768
defer close(files)
6869
ignoreFiles := []string{".gitignore", ".ignore", ".ldignore"}
6970
allIgnores := newIgnore(workspace, ignoreFiles)
71+
workspace = filepath.ToSlash(workspace)
7072

7173
readFile := func(path string, info os.FileInfo, err error) error {
7274
if err != nil || ctx.Err() != nil {
@@ -75,6 +77,7 @@ func readFiles(ctx context.Context, files chan<- file, workspace string) error {
7577
}
7678

7779
isDir := info.IsDir()
80+
path = filepath.ToSlash(path)
7881

7982
// Skip directories, hidden files, and ignored files
8083
if strings.HasPrefix(info.Name(), ".") || allIgnores.Match(path, isDir) {

0 commit comments

Comments
 (0)