(line string)
| 122 | var envFileLineRe = regexp.MustCompile(`^(?:export\s+)?([A-Z0-9_]+[A-Za-z0-9]*)=(.*)$`) |
| 123 | |
| 124 | func parseEnvironmentLine(line string) (string, string) { |
| 125 | m := envFileLineRe.FindStringSubmatch(line) |
| 126 | if m == nil { |
| 127 | return "", "" |
| 128 | } |
| 129 | return m[1], sanitizeEnvVarValue(m[2]) |
| 130 | } |
| 131 | |
| 132 | // Regex to parse a line from /etc/security/pam_env.conf or ~/.pam_environment. Follows the guidance from https://wiki.archlinux.org/title/Environment_variables#Using_pam_env |
| 133 | var confFileLineRe = regexp.MustCompile(`^([A-Z0-9_]+[A-Za-z0-9]*)\s+(?:(?:DEFAULT=)(\S+(?: \S+)*))\s*(?:(?:OVERRIDE=)(\S+(?: \S+)*))?\s*$`) |
no test coverage detected