src/os,src/syscall: move env copy code to syscall.Environ()

This commit is contained in:
Damian Gryski
2022-02-23 10:11:42 -08:00
committed by Ayke
parent 6b15a72895
commit bf23839931
2 changed files with 29 additions and 17 deletions
+1 -10
View File
@@ -8,7 +8,6 @@ package os
import (
"internal/testlog"
"strings"
"syscall"
)
@@ -138,13 +137,5 @@ func Clearenv() {
// Environ returns a copy of strings representing the environment,
// in the form "key=value".
func Environ() []string {
orig := syscall.Environ()
single := strings.Join(orig, "")
env := make([]string, len(orig))
for i, v := range orig {
s := single[:len(v)]
env[i] = s
single = single[len(v):]
}
return env
return syscall.Environ()
}