mirror of
https://github.com/golang/go
synced 2024-11-12 09:50:21 -07:00
io/ioutil: use pathname instead of name in docs to avoid confusion
caller of ioutil.TempFile() can use f.Name() to get "pathname" of the temporary file, instead of just the "name" of the file. Also remove an out-of-date comment about random number state. R=golang-dev, r CC=golang-dev https://golang.org/cl/6649054
This commit is contained in:
parent
422da762b7
commit
240834374a
@ -12,7 +12,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Random number state, accessed without lock; racy but harmless.
|
||||
// Random number state.
|
||||
// We generate random temporary file names so that there's a good
|
||||
// chance the file doesn't exist yet - keeps the number of tries in
|
||||
// TempFile to a minimum.
|
||||
@ -42,8 +42,8 @@ func nextSuffix() string {
|
||||
// for temporary files (see os.TempDir).
|
||||
// Multiple programs calling TempFile simultaneously
|
||||
// will not choose the same file. The caller can use f.Name()
|
||||
// to find the name of the file. It is the caller's responsibility to
|
||||
// remove the file when no longer needed.
|
||||
// to find the pathname of the file. It is the caller's responsibility
|
||||
// to remove the file when no longer needed.
|
||||
func TempFile(dir, prefix string) (f *os.File, err error) {
|
||||
if dir == "" {
|
||||
dir = os.TempDir()
|
||||
|
Loading…
Reference in New Issue
Block a user