forked from coop-cloud-mirrors/godotenv
fix: if a line contains multiple # characters, there will be issues w… (#238)
* fix: if a line contains multiple # characters, there will be issues when traversing from back to front * fix: typo
This commit is contained in:
@ -143,9 +143,9 @@ func extractVarValue(src []byte, vars map[string]string) (value string, rest []b
|
||||
}
|
||||
|
||||
// Work backwards to check if the line ends in whitespace then
|
||||
// a comment (ie asdasd # some comment)
|
||||
for i := endOfVar - 1; i >= 0; i-- {
|
||||
if line[i] == charComment && i > 0 {
|
||||
// a comment, ie: foo=bar # baz # other
|
||||
for i := 0; i < endOfVar; i++ {
|
||||
if line[i] == charComment && i < endOfVar {
|
||||
if isSpace(line[i-1]) {
|
||||
endOfVar = i
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user