The call to bytes.TrimRightFunc(src[0:i], trimFunc) in parser.go's extractVarValue removes a single escaped quote off the right side of the var value (if such a quote exists and it is the same as the quotes used to enclose the value). Is this intended behavior or a bug?
package main
import (
"fmt"
"github.com/joho/godotenv"
)
func main() {
m := map[string]string{"foo": `""`}
// Shows up in .env as foo="\"\""
godotenv.Write(m, ".env")
env, _ := godotenv.Read(".env")
// Expecting ""
// Instead prints "\
// This is because the escaping \ remains after the quote's removed
fmt.Println(env["foo"])
}
The call to
bytes.TrimRightFunc(src[0:i], trimFunc)
in parser.go'sextractVarValue
removes a single escaped quote off the right side of the var value (if such a quote exists and it is the same as the quotes used to enclose the value). Is this intended behavior or a bug?