2017-10-07 00:16:47 +00:00
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows
|
2017-10-07 00:16:47 +00:00
|
|
|
|
|
|
|
package runtime
|
|
|
|
|
|
|
|
func gogetenv(key string) string {
|
|
|
|
env := environ()
|
|
|
|
if env == nil {
|
|
|
|
throw("getenv before env init")
|
|
|
|
}
|
2018-12-28 15:30:48 +00:00
|
|
|
for _, s := range env {
|
2017-10-07 00:16:47 +00:00
|
|
|
if len(s) > len(key) && s[len(key)] == '=' && s[:len(key)] == key {
|
|
|
|
return s[len(key)+1:]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|