mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
dc6726b37f
commit
0acd879c26
23 changed files with 348 additions and 386 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue