go/src/io
Tom Limoncelli 191efbc419 io/ioutil: change TempFile prefix to a pattern
Users of TempFile need to be able to supply the suffix, especially
when using operating systems that give semantic meaning to the
filename extension such as Windows.  Renaming the file to include
an extension after the fact is insufficient as it could lead to
race conditions.

If the string given to TempFile includes a "*", the random string
replaces the "*". For example "myname.*.bat" will result in a random
filename such as "myname.123456.bat".  If no "*' is included the
old behavior is retained, and the random digits are appended to the
end.

If multiple "*" are included, the final one is replaced, thus
permitting a pathological programmer to create filenames such as
"foo*.123456.bat" but not "foo.123456.*.bat"

Fixes #4896

Change-Id: Iae7f0980b4de6d7d31b87c8c3c3d40767b283c1f
Reviewed-on: https://go-review.googlesource.com/105675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-12 20:00:25 +00:00
..
ioutil io/ioutil: change TempFile prefix to a pattern 2018-04-12 20:00:25 +00:00
example_test.go io: add example for Pipe 2017-08-22 19:42:20 +00:00
io.go io: document that ReadAtLeast and ReadFull can drop errors 2018-03-26 17:38:36 +00:00
io_test.go io: eliminate full copy of copy loop in CopyN 2017-11-16 02:24:37 +00:00
multi.go io: document and test MultiWriter error behavior 2017-11-15 21:27:42 +00:00
multi_test.go io: document and test MultiWriter error behavior 2017-11-15 21:27:42 +00:00
pipe.go io: fix Pipe regression with differing error types 2017-11-02 23:05:53 +00:00
pipe_test.go io: fix Pipe regression with differing error types 2017-11-02 23:05:53 +00:00