Skip to content

Commit d85e4c1

Browse files
committed
Remove validation
Signed-off-by: Ulysses Souza <[email protected]>
1 parent e417b72 commit d85e4c1

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

godotenv.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,6 @@ func parseLine(line string, envMap map[string]string, lookupFn func(string)(stri
311311
// Parse the key
312312
key = strings.TrimSpace(strings.TrimPrefix(splitString[0], "export "))
313313
key = exportRegex.ReplaceAllString(key, "$1")
314-
if err = validateVariableName(key); err != nil {
315-
return
316-
}
317314

318315
// Environment inherited variable
319316
if firstEquals < 0 && firstColon < 0 {
@@ -335,20 +332,11 @@ func parseLine(line string, envMap map[string]string, lookupFn func(string)(stri
335332
return
336333
}
337334

338-
func validateVariableName(key string) error {
339-
key = strings.TrimSpace(strings.TrimPrefix(key, "export "))
340-
if !variableNameRegex.MatchString(key) {
341-
return fmt.Errorf("invalid variable name %q", key)
342-
}
343-
return nil
344-
}
345-
346335
var (
347336
singleQuotesRegex = regexp.MustCompile(`\A'(.*)'\z`)
348337
doubleQuotesRegex = regexp.MustCompile(`\A"(.*)"\z`)
349338
escapeRegex = regexp.MustCompile(`\\.`)
350339
unescapeCharsRegex = regexp.MustCompile(`\\([^$])`)
351-
variableNameRegex = regexp.MustCompile(`^[_\\.a-zA-Z0-9]+$`)
352340

353341
noLookupFn = func(string)(string, bool) {return "", true}
354342
)

0 commit comments

Comments
 (0)