godotenv
godotenv copied to clipboard
Multiline string support
Supersedes #118 (same PR, but rebased off master and with some extra test coverage) and fixes #117
Still failing on Windows. From the CI tests:
--- FAIL: TestLoadQuotedEnv (0.00s)
7
godotenv_test.go:38: Mismatch for key 'OPTION_K': expected '"line one\nthis is \\'quoted\\'\none more line"' got '"line one\r\nthis is \\'quoted\\'\r\none more line"'
8
godotenv_test.go:38: Mismatch for key 'OPTION_L': expected '"line 1\nline 2"' got '"line 1\r\nline 2"'
9
godotenv_test.go:38: Mismatch for key 'OPTION_M': expected '"line one\nthis is \"quoted\"\none more line"' got '"line one\r\nthis is \"quoted\"\r\none more line"'
10
godotenv_test.go:38: Mismatch for key 'OPTION_J': expected '"line 1\nline 2"' got '"line 1\r\nline 2"'
It looks like we want to convert Windows newlines into Unix newlines.
Perhaps the winning strategy will be to Replace \r\n
with \n
(then replace \r
with \n
just to be safe) and then parse without any special conditions for \r
thereafter.
Thoughts?
@joho please see the suggestion I made, that will fix this issue and get this project multiline support
thanks for contributing this work!
would it be possible for me to help with merging?