segmentio / golines

A golang formatter that fixes long lines
MIT License
903 stars 56 forks source link

Panic if file is missing `package` declaration #99

Open twavv opened 1 year ago

twavv commented 1 year ago

This is probably related to an upstream issue in dave/dst but wanted to flag it here at least just so it's findable if anyone else ever runs into this.

Found this error when the first line of the file was import ( (instead of the usual package <foo> declaration).

telemachus commented 1 year ago

I can't reproduce this. In a folder with only one file and with no package declaration, golines doesn't panic for me.

Can you provide a minimum example that leads to the panic? (Also what version of golines and go are you using?)