libgo: update to go1.9
[official-gcc.git] / libgo / go / runtime / env_posix.go
blobddf3c02c02567fc046d649f9c4738d925f5965f8
1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows
7 package runtime
9 func gogetenv(key string) string {
10 env := environ()
11 if env == nil {
12 throw("getenv before env init")
14 for _, s := range env {
15 if len(s) > len(key) && s[len(key)] == '=' && s[:len(key)] == key {
16 return s[len(key)+1:]
19 return ""