Fix ignored_paths
This commit is contained in:
parent
8dbb79377a
commit
b1c4fa9abe
|
@ -397,7 +397,8 @@ func (p *Project) tool(stop <-chan bool, path string) error {
|
|||
func (p *Project) walk(path string, info os.FileInfo, err error) error {
|
||||
for _, v := range p.Watcher.Ignore {
|
||||
s := append([]string{p.Path}, strings.Split(v, string(os.PathSeparator))...)
|
||||
if strings.Contains(path, filepath.Join(s...)) {
|
||||
absolutePath, _ := filepath.Abs(filepath.Join(s...))
|
||||
if path == absolutePath || strings.HasPrefix(path, absolutePath+string(os.PathSeparator)) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ func TestWalk(t *testing.T) {
|
|||
{"/go/project", true},
|
||||
{"/go/project/main.go", false},
|
||||
{"/go/project/main_test.go", false},
|
||||
{"/go/project/vendorish/foo", true},
|
||||
// invalid relative path
|
||||
{"./relative/path", true},
|
||||
{"./relative/path/file.go", false},
|
||||
|
@ -66,7 +67,7 @@ func TestWalk(t *testing.T) {
|
|||
t.Errorf("Exepeted %d files, but was %d", 2, p.files)
|
||||
}
|
||||
|
||||
if p.folders != 1 {
|
||||
if p.folders != 2 {
|
||||
t.Errorf("Exepeted %d folders, but was %d", 2, p.folders)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue