nelsam/vidar

Panic when parse incorrect .go file

Kvaz1r opened this issue · 0 comments

Description

If file contents obvious mistake - an empty receiver for function thus getting this error.
I could just added checking to corresponding line, but not sure will it be correct (for me this part of code is dark forest :))

Steps to reproduce

  1. Add to any correct golang code such chunk:
func () foo() {
}
  1. Try to save

Stack trace

panic: runtime error: index out of range

goroutine 19 [running]:
github.com/nelsam/vidar/navigator.(*TOC).parseAstFile(0xc042310380, 0xc04235eb40
, 0x3b, 0xc042213680, 0x0)
        E:/gopath/src/github.com/nelsam/vidar/navigator/toc_tree.go:355 +0x84d