karrick / godirwalk

Fast directory traversal for Golang
BSD 2-Clause "Simplified" License
705 stars 70 forks source link

Issue with symbolic links with absolute path #8

Closed gofort closed 6 years ago

gofort commented 6 years ago

I have something like this

root@loc-v-gcdn-edge-1 ~/go/src/xxx/mapi $ tree insales-cache/
insales-cache/
├── 3
│   └── test_sample
└── test
    ├── 1
    │   └── assets3-insales-ru-728ddd54_sample
    ├── 2
    │   ├── 30cdb40e687398728e13ac3589c233e9
    │   └── 957ecf0fb64bde07fa85a657ffc333e9
    └── 3 -> /root/go/src/xxx/mapi/insales-cache/3

And I have the following error from walk function (boolean after path is a returned value from IsRegular function):

=== RUN   TestXXX
/root/go/src/xxx/mapi/insales-cache/test false
/root/go/src/xxx/mapi/insales-cache/test/1 false
/root/go/src/xxx/insales-cache/test/1/assets3-insales-ru-728ddd54_sample true
/root/go/src/xxx/mapi/insales-cache/test/2 false
/root/go/src/xxx/mapi/insales-cache/test/2/30cdb40e687398728e13ac3589c233e9 true
/root/go/src/xxx/mapi/insales-cache/test/2/957ecf0fb64bde07fa85a657ffc333e9 true
/root/go/src/xxx/mapi/insales-cache/test/3 false
--- FAIL: TestXXX (0.01s)
    command_test.go:35: cannot Stat: stat /root/go/src/xxx/mapi/insales-cache/test/root/go/src/xxx/mapi/insales-cache/3: no such file or directory

I see pull request here: https://github.com/karrick/godirwalk/pull/4 Please merge this :)

karrick commented 6 years ago

Thanks for bringing this to my attention. I have merged the PR under v1.7.1