There is no error handling in `filepath.Walk`
nakamura244 opened this issue · 2 comments
nakamura244 commented
Hi @roblaszczak
It is a good analysis tool. And I use it.
If the path set in the argument is wrong (no such file or directory), a runtime error will occur.
So I think I should do error handling of no such file or directory
Thank you.
Feresey commented
gpomykala commented
yep, similar error:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x10dd13a]
goroutine 1 [running]:
github.com/roblaszczak/go-cleanarch/cleanarch.(*Validator).Validate.func1(0xc00001e180, 0x40, 0x0, 0x0, 0x11371c8, 0xc00006e2a0, 0x11cb500, 0xc000104000)
/Users/gpom/go/pkg/mod/github.com/roblaszczak/go-cleanarch@v1.2.1/cleanarch/cleanarch.go:68 +0x5a
path/filepath.Walk(0xc00001e180, 0x40, 0xc00006ab28, 0x10ae2b1, 0xc000070dd0)
/usr/local/Cellar/go/1.16.3/libexec/src/path/filepath/path.go:499 +0x7e
github.com/roblaszczak/go-cleanarch/cleanarch.(*Validator).Validate(0xc00006ac58, 0xc00001e180, 0x40, 0x0, 0x11fffd0, 0x0, 0x0, 0x56, 0x0, 0x0, ...)
/Users/gpom/go/pkg/mod/github.com/roblaszczak/go-cleanarch@v1.2.1/cleanarch/cleanarch.go:67 +0xcb
main.main()
/Users/gpom/go/pkg/mod/github.com/roblaszczak/go-cleanarch@v1.2.1/main.go:61 +0x696
FYI i did use it with common go tool path go-cleanarch ./... before realizing the usage is just go-cleanarch for current dir