nelsam / vidar

vidar is a highly experimental Go editor, written in Go, using gxui
The Unlicense
50 stars 7 forks source link

Panic when parse incorrect .go file #158

Closed Kvaz1r closed 4 years ago

Kvaz1r commented 5 years ago

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() {
    }
  2. 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