Commit 24083437 authored by Shenghou Ma's avatar Shenghou Ma

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
parent 422da762
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
"time" "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 // 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 // chance the file doesn't exist yet - keeps the number of tries in
// TempFile to a minimum. // TempFile to a minimum.
...@@ -42,8 +42,8 @@ func nextSuffix() string { ...@@ -42,8 +42,8 @@ func nextSuffix() string {
// for temporary files (see os.TempDir). // for temporary files (see os.TempDir).
// Multiple programs calling TempFile simultaneously // Multiple programs calling TempFile simultaneously
// will not choose the same file. The caller can use f.Name() // 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 // to find the pathname of the file. It is the caller's responsibility
// remove the file when no longer needed. // to remove the file when no longer needed.
func TempFile(dir, prefix string) (f *os.File, err error) { func TempFile(dir, prefix string) (f *os.File, err error) {
if dir == "" { if dir == "" {
dir = os.TempDir() dir = os.TempDir()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment