2017-03-02 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libgo / go / runtime / env_posix.go
blobe076edb85d012f2f383709da45f6635cc82a9f5d
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 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 environ() {
15 if len(s) > len(key) && s[len(key)] == '=' && s[:len(key)] == key {
16 return s[len(key)+1:]
19 return ""