diff --git a/godotenv_test.go b/godotenv_test.go index 8520a24..edb5781 100644 --- a/godotenv_test.go +++ b/godotenv_test.go @@ -400,8 +400,6 @@ func TestParsing(t *testing.T) { parseAndCompare(t, `FOO="bar\\r\ b\az"`, "FOO", "bar\\r baz") parseAndCompare(t, `="value"`, "", "value") - parseAndCompare(t, `KEY="`, "KEY", "\"") - parseAndCompare(t, `KEY="value`, "KEY", "\"value") // unquoted whitespace around keys should be ignored parseAndCompare(t, " KEY =value", "KEY", "value") diff --git a/parser.go b/parser.go index f2cbddf..203f976 100644 --- a/parser.go +++ b/parser.go @@ -101,8 +101,8 @@ loop: break loop case '_': default: - // variable name should match [A-Za-z0-9_] - if unicode.IsLetter(rchar) || unicode.IsNumber(rchar) { + // variable name should match [A-Za-z0-9_.] + if unicode.IsLetter(rchar) || unicode.IsNumber(rchar) || rchar == '.' { continue }