Source File
env_unix.go
Belonging Package
syscall
package syscall
import (
)
envs []string = runtime_envs()
)
func () []string // in package runtime
envs[] = ""
}
break
}
}
}
}
func ( string) error {
envOnce.Do(copyenv)
envLock.Lock()
defer envLock.Unlock()
if , := env[]; {
envs[] = ""
delete(env, )
}
unsetenv_c()
return nil
}
func ( string) ( string, bool) {
envOnce.Do(copyenv)
if len() == 0 {
return "", false
}
envLock.RLock()
defer envLock.RUnlock()
, := env[]
if ! {
return "", false
}
:= envs[]
for := 0; < len(); ++ {
if [] == '=' {
return [+1:], true
}
}
return "", false
}
func (, string) error {
envOnce.Do(copyenv)
if len() == 0 {
return EINVAL
}
for := 0; < len(); ++ {
if [] == '=' || [] == 0 {
return EINVAL
}
if runtime.GOOS != "plan9" {
for := 0; < len(); ++ {
if [] == 0 {
return EINVAL
}
}
}
envLock.Lock()
defer envLock.Unlock()
, := env[]
:= + "=" +
if {
envs[] =
} else {
= len(envs)
envs = append(envs, )
}
env[] =
setenv_c(, )
return nil
}
func () {
envOnce.Do(copyenv) // prevent copyenv in Getenv/Setenv
envLock.Lock()
defer envLock.Unlock()
for := range env {
unsetenv_c()
}
env = make(map[string]int)
envs = []string{}
}
func () []string {
envOnce.Do(copyenv)
envLock.RLock()
defer envLock.RUnlock()
:= make([]string, 0, len(envs))
for , := range envs {
if != "" {
= append(, )
}
}
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |