asticode / go-astitodo

Parse TODOs in your GO code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve error message on non-existing path

tovare opened this issue · comments

Hi,

Not a huge issue but it would be nice if an invalid argument resulted in a nicer message.

$ astitodo  asdfg

Panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x4f65f6]

goroutine 1 [running]:
github.com/asticode/go-astitodo.(*TODOs).extract.func1(0x7ffd6604ceca, 0x1, 0x0, 0x0, 0x55dea0, 0xc0000e1020, 0x30, 0x524f80)
        /home/ec2-user/go/src/github.com/asticode/go-astitodo/astitodo.go:55 +0x66
path/filepath.Walk(0x7ffd6604ceca, 0x1, 0xc0000e0ff0, 0x1, 0xc0000ea500)
        /usr/local/go/src/path/filepath/path.go:401 +0x6a
github.com/asticode/go-astitodo.(*TODOs).extract(0xc0000ea500, 0x7ffd6604ceca, 0x1, 0x64f3a0, 0x0, 0x0, 0x0, 0x0)
        /home/ec2-user/go/src/github.com/asticode/go-astitodo/astitodo.go:43 +0x8a
github.com/asticode/go-astitodo.Extract(0x7ffd6604ceca, 0x1, 0x64f3a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/ec2-user/go/src/github.com/asticode/go-astitodo/astitodo.go:38 +0x76
main.main()
        /home/ec2-user/go/src/github.com/asticode/go-astitodo/astitodo/main.go:32 +0xf3

Tried with go version go1.11beta1 linux/amd64 and go version go1.11rc1 linux/amd64

Cheers :)

@tovare nice catch!

I've pushed a fixed on master.

Cheers