Skip to content

Commit a208aa7

Browse files
jeffwidmanianlancetaylor
authored andcommitted
io/ioutil: add deprecation markers to ioutil
All the code in ioutil just forwards functionality to code in either the io or os packages, per issue 42026. This change adds the "Deprecated" marker to all the functions in this package. For #42026 Fixes #51927 Change-Id: Ia807bc5c0edb06cc80ec7e35917dcfe2ad50f0ea GitHub-Last-Rev: 3c3603f GitHub-Pull-Request: #51961 Reviewed-on: https://go-review.googlesource.com/c/go/+/395918 Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
1 parent b10164b commit a208aa7

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/io/ioutil/ioutil.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// Package ioutil implements some I/O utility functions.
66
//
7-
// As of Go 1.16, the same functionality is now provided
7+
// Deprecated: As of Go 1.16, the same functionality is now provided
88
// by package io or package os, and those implementations
99
// should be preferred in new code.
1010
// See the specific function documentation for details.
@@ -22,7 +22,7 @@ import (
2222
// defined to read from src until EOF, it does not treat an EOF from Read
2323
// as an error to be reported.
2424
//
25-
// As of Go 1.16, this function simply calls io.ReadAll.
25+
// Deprecated: As of Go 1.16, this function simply calls io.ReadAll.
2626
func ReadAll(r io.Reader) ([]byte, error) {
2727
return io.ReadAll(r)
2828
}
@@ -32,7 +32,7 @@ func ReadAll(r io.Reader) ([]byte, error) {
3232
// reads the whole file, it does not treat an EOF from Read as an error
3333
// to be reported.
3434
//
35-
// As of Go 1.16, this function simply calls os.ReadFile.
35+
// Deprecated: As of Go 1.16, this function simply calls os.ReadFile.
3636
func ReadFile(filename string) ([]byte, error) {
3737
return os.ReadFile(filename)
3838
}
@@ -41,7 +41,7 @@ func ReadFile(filename string) ([]byte, error) {
4141
// If the file does not exist, WriteFile creates it with permissions perm
4242
// (before umask); otherwise WriteFile truncates it before writing, without changing permissions.
4343
//
44-
// As of Go 1.16, this function simply calls os.WriteFile.
44+
// Deprecated: As of Go 1.16, this function simply calls os.WriteFile.
4545
func WriteFile(filename string, data []byte, perm fs.FileMode) error {
4646
return os.WriteFile(filename, data, perm)
4747
}
@@ -51,7 +51,7 @@ func WriteFile(filename string, data []byte, perm fs.FileMode) error {
5151
// sorted by filename. If an error occurs reading the directory,
5252
// ReadDir returns no directory entries along with the error.
5353
//
54-
// As of Go 1.16, os.ReadDir is a more efficient and correct choice:
54+
// Deprecated: As of Go 1.16, os.ReadDir is a more efficient and correct choice:
5555
// it returns a list of fs.DirEntry instead of fs.FileInfo,
5656
// and it returns partial results in the case of an error
5757
// midway through reading a directory.
@@ -72,13 +72,13 @@ func ReadDir(dirname string) ([]fs.FileInfo, error) {
7272
// NopCloser returns a ReadCloser with a no-op Close method wrapping
7373
// the provided Reader r.
7474
//
75-
// As of Go 1.16, this function simply calls io.NopCloser.
75+
// Deprecated: As of Go 1.16, this function simply calls io.NopCloser.
7676
func NopCloser(r io.Reader) io.ReadCloser {
7777
return io.NopCloser(r)
7878
}
7979

8080
// Discard is an io.Writer on which all Write calls succeed
8181
// without doing anything.
8282
//
83-
// As of Go 1.16, this value is simply io.Discard.
83+
// Deprecated: As of Go 1.16, this value is simply io.Discard.
8484
var Discard io.Writer = io.Discard

src/io/ioutil/tempfile.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
// to find the pathname of the file. It is the caller's responsibility
2121
// to remove the file when no longer needed.
2222
//
23-
// As of Go 1.17, this function simply calls os.CreateTemp.
23+
// Deprecated: As of Go 1.17, this function simply calls os.CreateTemp.
2424
func TempFile(dir, pattern string) (f *os.File, err error) {
2525
return os.CreateTemp(dir, pattern)
2626
}
@@ -35,7 +35,7 @@ func TempFile(dir, pattern string) (f *os.File, err error) {
3535
// will not choose the same directory. It is the caller's responsibility
3636
// to remove the directory when no longer needed.
3737
//
38-
// As of Go 1.17, this function simply calls os.MkdirTemp.
38+
// Deprecated: As of Go 1.17, this function simply calls os.MkdirTemp.
3939
func TempDir(dir, pattern string) (name string, err error) {
4040
return os.MkdirTemp(dir, pattern)
4141
}

0 commit comments

Comments
 (0)