diff options
author | Russ Cox <rsc@golang.org> | 2020-12-02 12:49:20 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2020-12-04 16:49:30 +0000 |
commit | 478bde3a4388997924a02ee9296864866d8ba3ba (patch) | |
tree | f474d0ffa817826e9d07f79a0df463da23060a32 /doc/go1.16.html | |
parent | 5d4569197eeef42862b8ea87a7e8ccda1cd061a0 (diff) | |
download | go-478bde3a4388997924a02ee9296864866d8ba3ba.tar.gz go-478bde3a4388997924a02ee9296864866d8ba3ba.zip |
io/fs: add Sub
Sub provides a convenient way to refer to a subdirectory
automatically in future operations, like Unix's chdir(2).
The CL also includes updates to fstest to check Sub implementations.
As part of updating fstest, I changed the meaning of TestFS's
expected list to introduce a special case: if you list no expected files,
that means the FS must be empty. In general it's OK not to list all
the expected files, but if you list none, that's almost certainly a
mistake - if your FS were broken and empty, you wouldn't find out.
Making no expected files mean "must be empty" makes the mistake
less likely - if your file system ever worked, then your test will keep
it working.
That change found a testing bug: embedtest was making exactly
that mistake.
Fixes #42322.
Change-Id: I63fd4aa866b30061a0e51ca9a1927e576d6ec41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/274856
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'doc/go1.16.html')
-rw-r--r-- | doc/go1.16.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/doc/go1.16.html b/doc/go1.16.html index 4d4b459009..62d9b97db8 100644 --- a/doc/go1.16.html +++ b/doc/go1.16.html @@ -384,7 +384,7 @@ Do not send CLs removing the interior tags from such phrases. the new <a href="/pkg/embed/#FS">embed.FS</code></a> type implements <code>fs.FS</code>, as does <a href="/pkg/archive/zip/#Reader"><code>zip.Reader</code></a>. - The new <a href="/pkg/os/#Dir"><code>os.Dir</code></a> function + The new <a href="/pkg/os/#DirFS"><code>os.DirFS</code></a> function provides an implementation of <code>fs.FS</code> backed by a tree of operating system files. </p> |