From 39bafed1021a49d7fd7458a34989601a8493f79a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 30 May 2023 10:42:57 -0700 Subject: [PATCH] doc/go1.21: document io/fs formatting functions Also document the new String methods that call them. For #54451 Change-Id: I5cd7e0fc6c84097bba6d29c4d6012ed3c8bb1e0d Reviewed-on: https://go-review.googlesource.com/c/go/+/499177 Reviewed-by: Eli Bendersky Reviewed-by: Ian Lance Taylor TryBot-Bypass: Ian Lance Taylor Auto-Submit: Ian Lance Taylor --- doc/go1.21.html | 109 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 99 insertions(+), 10 deletions(-) diff --git a/doc/go1.21.html b/doc/go1.21.html index 31157b0251..d0fd953ba1 100644 --- a/doc/go1.21.html +++ b/doc/go1.21.html @@ -292,6 +292,45 @@ Do not send CLs removing the interior tags from such phrases. TODO: complete this section

+
archive/tar
+
+

+ The implementation of the + io/fs.FileInfo + interface returned by + Header.FileInfo + now implements a String method that calls + io/fs.FormatFileInfo. +

+
+
+ +
archive/zip
+
+

+ The implementation of the + io/fs.FileInfo + interface returned by + FileHeader.FileInfo + now implements a String method that calls + io/fs.FormatFileInfo. +

+ +

+ The implementation of the + io/fs.DirEntry + interface returned by the + io/fs.ReadDirFile.ReadDir + method of the + io/fs.File + returned by + Reader.Open + now implements a String method that calls + io/fs.FormatDirEntry. +

+
+
+
bytes

@@ -430,6 +469,13 @@ Do not send CLs removing the interior tags from such phrases.

TODO: https://go.dev/cl/483235: embed: implement openFile.ReadAt

+ +

+ Calling FS.Open.Stat + will return a type that now implements a String + method that calls + io/fs.FormatFileInfo. +

@@ -465,14 +511,6 @@ Do not send CLs removing the interior tags from such phrases. -
fs
-
-

- TODO: https://go.dev/issue/54451: standard implementations of FileInfo and DirEntry should implement fmt.Stringer -

-
-
-
go/ast

@@ -541,8 +579,25 @@ Do not send CLs removing the interior tags from such phrases.

io/fs
-

- TODO: https://go.dev/cl/489555: io/fs: add FormatFileInfo and FormatDirEntry functions; modified api/next/54451.txt +

+ The new + FormatFileInfo + function returns a formatted version of a + FileInfo. + The new + FormatDirEntry + function returns a formatted version of a + DirEntry. + The implementation of + DirEntry + returned by + ReadDir now + implements a String method that calls + FormatDirEntry, + and the same is true for + the DirEntry + value passed to + WalkDirFunc.

@@ -705,9 +760,32 @@ Do not send CLs removing the interior tags from such phrases. On Windows the os package now supports working with files whose names, stored as UTF-16, can't be represented as valid UTF-8.

+ +

+ The implementation of the + io/fs.DirEntry + interface returned by the + ReadDir function and + the File.ReadDir + method now implements a String method that calls + io/fs.FormatDirEntry. +

+
path/filepath
+
+

+ The implementation of the + io/fs.DirEntry + interface passed to the function argument of + WalkDir + now implements a String method that calls + io/fs.FormatDirEntry. +

+
+
+
reflect
@@ -888,6 +966,17 @@ Do not send CLs removing the interior tags from such phrases.
+
testing/fstest
+
+

+ Calling Open.Stat + will return a type that now implements a String + method that calls + io/fs.FormatFileInfo. +

+
+
+
testing/slogtest

-- 2.44.0