| // Copyright 2010 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. |
| // +build darwin freebsd linux openbsd |
| // Unix environment variables. |
| var env map[string]string |
| var envs []string // provided by runtime |
| func setenv_c(k, v string) |
| env = make(map[string]string) |
| for j := 0; j < len(s); j++ { |
| func Getenv(key string) (value string, found bool) { |
| func Setenv(key, value string) error { |
| setenv_c(key, value) // is a no-op if cgo isn't loaded |
| envOnce.Do(copyenv) // prevent copyenv in Getenv/Setenv |
| env = make(map[string]string) |
| // TODO(bradfitz): pass through to C |
| func Environ() []string { |
| a := make([]string, len(env)) |