Version
v1.67.3-2-g3b7d6ad (current main branch + the reproduction test case I linked below as well)
Describe the bug
When parsing a file that contains two byte-order-marks at the start of the file, which are not followed by a valid non-comment statement, causes the parser to trip with an error like this:
key-value delimiter not found: # this line is not parsed successfully
To reproduce
I prepared a test case, based on the UTF-8-BOM.ini testcase, that cleanly reproduces the issue, so you can simply checkout my fork and run the test case.
Expected behavior
These files are out in the wild and IMHO the parser should at least be clever enough to recognize them and warn the user that their file is technically broken. One could argue that it's not the responsibility of go-ini, but I would hope that it could be tolerant enough to return the valid data it can parse, and possibly fix the error when editing a file directly.
Additional context
This has originally been reported as an issue for editorconfig-checker, which uses the editorconfig-core library, which in turn uses go-ini to parse the .editorconfig files:
Code of Conduct
Version
v1.67.3-2-g3b7d6ad (current main branch + the reproduction test case I linked below as well)
Describe the bug
When parsing a file that contains two byte-order-marks at the start of the file, which are not followed by a valid non-comment statement, causes the parser to trip with an error like this:
To reproduce
I prepared a test case, based on the UTF-8-BOM.ini testcase, that cleanly reproduces the issue, so you can simply checkout my fork and run the test case.
go test ./...Expected behavior
These files are out in the wild and IMHO the parser should at least be clever enough to recognize them and warn the user that their file is technically broken. One could argue that it's not the responsibility of go-ini, but I would hope that it could be tolerant enough to return the valid data it can parse, and possibly fix the error when editing a file directly.
Additional context
This has originally been reported as an issue for editorconfig-checker, which uses the editorconfig-core library, which in turn uses go-ini to parse the
.editorconfigfiles:.editorconfigcan lead to errors editorconfig-checker/editorconfig-checker#576Code of Conduct