io/ioutil: Deprecate `TempFile` and `TempDir`

These were deprecated in `go` `1.17`, so marked them as officially
`Deprecated: `.

Fix https://github.com/golang/go/issues/51927
This commit is contained in:
Jeff Widman 2022-03-26 00:00:28 -07:00
parent aae1fbdd37
commit 3c3603f368
1 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ import (
// to find the pathname of the file. It is the caller's responsibility
// to remove the file when no longer needed.
//
// As of Go 1.17, this function simply calls os.CreateTemp.
// Deprecated: As of Go 1.17, this function simply calls os.CreateTemp.
func TempFile(dir, pattern string) (f *os.File, err error) {
return os.CreateTemp(dir, pattern)
}
@ -35,7 +35,7 @@ func TempFile(dir, pattern string) (f *os.File, err error) {
// will not choose the same directory. It is the caller's responsibility
// to remove the directory when no longer needed.
//
// As of Go 1.17, this function simply calls os.MkdirTemp.
// Deprecated: As of Go 1.17, this function simply calls os.MkdirTemp.
func TempDir(dir, pattern string) (name string, err error) {
return os.MkdirTemp(dir, pattern)
}