diff options
Diffstat (limited to 'llgo/third_party/gofrontend/libgo/go/os/env.go')
| -rw-r--r-- | llgo/third_party/gofrontend/libgo/go/os/env.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llgo/third_party/gofrontend/libgo/go/os/env.go b/llgo/third_party/gofrontend/libgo/go/os/env.go index d0494a47634..a4ede15e613 100644 --- a/llgo/third_party/gofrontend/libgo/go/os/env.go +++ b/llgo/third_party/gofrontend/libgo/go/os/env.go @@ -33,7 +33,7 @@ func ExpandEnv(s string) string { return Expand(s, Getenv) } -// isSpellSpecialVar reports whether the character identifies a special +// isShellSpecialVar reports whether the character identifies a special // shell variable such as $*. func isShellSpecialVar(c uint8) bool { switch c { @@ -48,7 +48,7 @@ func isAlphaNum(c uint8) bool { return c == '_' || '0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' } -// getName returns the name that begins the string and the number of bytes +// getShellName returns the name that begins the string and the number of bytes // consumed to extract it. If the name is enclosed in {}, it's part of a ${} // expansion and two more bytes are needed than the length of the name. func getShellName(s string) (string, int) { @@ -81,6 +81,15 @@ func Getenv(key string) string { return v } +// LookupEnv retrieves the value of the environment variable named +// by the key. If the variable is present in the environment the +// value (which may be empty) is returned and the boolean is true. +// Otherwise the returned value will be empty and the boolean will +// be false. +func LookupEnv(key string) (string, bool) { + return syscall.Getenv(key) +} + // Setenv sets the value of the environment variable named by the key. // It returns an error, if any. func Setenv(key, value string) error { |

