syscall: take over env implementation

The environment is needed by package time, which
we want not to depend on os (so that os can use
time.Time), so push down into syscall.

Delete syscall.Sleep, now unnecessary.

The package os environment API is preserved;
it is only the implementation that is moving to syscall.

Delete os.Envs, which was undocumented,
uninitialized on Windows and Plan 9, and
not maintained by Setenv and Clearenv.
Code can call os.Environ instead.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5370091
This commit is contained in:
Russ Cox 2011-11-14 14:06:50 -05:00
parent dc6726b37f
commit 0acd879c26
23 changed files with 348 additions and 386 deletions

View file

@ -241,3 +241,12 @@ func Pipe() (r *File, w *File, err error) {
return NewFile(p[0], "|0"), NewFile(p[1], "|1"), nil
}
// TempDir returns the default directory to use for temporary files.
func TempDir() string {
dir := Getenv("TMPDIR")
if dir == "" {
dir = "/tmp"
}
return dir
}