go-ini/ini

Add line number and column output to error

kehoecj opened this issue · 2 comments

Describe the feature

It would be beneficial to users of this library to add line and column number to the error output to help users determine the source of the error. The current implementation only displays the text output of the line where the error ocurred.

Describe the solution you'd like

Line and Column output in the error output

Describe alternatives you've considered

I attempted to calculate it by utilizing the parse function directly but it was not possible

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

@unknwon I'd like to take a shot at implementing this unless you have any concerns. Would you prefer the error to automatically include the line/column in the message, a solution like JSON Offset, or something else?

@unknwon I'd like to take a shot at implementing this unless you have any concerns. Would you prefer the error to automatically include the line/column in the message, a solution like JSON Offset, or something else?

Hey @kehoecj, thanks for your interests!

Ideally, the error message should have the line and column (both 1-based) of the position. Personally, I find it very hard to use offset because that means I can't just open the editor to fix the file, and always have to counting from the beginning of the file.