1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:54:43 -07:00

go/ssa/interp: add intrinsic for runtime.environ, recently added.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/135120043
This commit is contained in:
Alan Donovan 2014-08-28 16:56:49 -04:00
parent 86df324d65
commit cd5b7ff318

View File

@ -97,6 +97,7 @@ func init() {
"(*runtime.Func).Entry": ext۰runtime۰Func۰Entry,
"(*runtime.Func).FileLine": ext۰runtime۰Func۰FileLine,
"(*runtime.Func).Name": ext۰runtime۰Func۰Name,
"runtime.environ": ext۰runtime۰environ,
"runtime.getgoroot": ext۰runtime۰getgoroot,
"strings.IndexByte": ext۰strings۰IndexByte,
"sync.runtime_Semacquire": ext۰sync۰runtime_Semacquire,
@ -278,6 +279,16 @@ func ext۰runtime۰FuncForPC(fr *frame, args []value) value {
return &Func
}
func ext۰runtime۰environ(fr *frame, args []value) value {
// We don't return syscall.envs (see Interpret()) because it's
// not a dependency of runtime so the package might not exist.
var env []value
for _, s := range os.Environ() {
env = append(env, s)
}
return env
}
func ext۰runtime۰getgoroot(fr *frame, args []value) value {
return os.Getenv("GOROOT")
}