0
1
mirror of https://github.com/golang/go synced 2025-03-03 04:37:58 +00:00
go/api/next/49580.txt
Roxy Light f7b8dd9033 io/fs: add ReadLinkFS interface
Added implementations for *io/fs.subFS, os.DirFS, and testing/fstest.MapFS.
Amended testing/fstest.TestFS to check behavior.

Addressed TODOs in archive/tar and os.CopyFS around symbolic links.

I am deliberately not changing archive/zip in this CL,
since it currently does not resolve symlinks
as part of its filesystem implementation.
I am unsure of the compatibility restrictions on doing so,
so figured it would be better to address independently.

testing/fstest.MapFS now includes resolution of symlinks,
with MapFile.Data storing the symlink data.
The behavior change there seemed less intrusive,
especially given its intended usage in tests,
and it is especially helpful in testing the io/fs function implementations.

Fixes #49580

Change-Id: I58ec6915e8cc97341cdbfd9c24c67d1b60139447
Reviewed-on: https://go-review.googlesource.com/c/go/+/385534
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Funda Secgin <fundasecgin33@gmail.com>
2025-02-03 08:38:43 -08:00

9 lines
568 B
Plaintext

pkg io/fs, func Lstat(FS, string) (FileInfo, error) #49580
pkg io/fs, func ReadLink(FS, string) (string, error) #49580
pkg io/fs, type ReadLinkFS interface { Lstat, Open, ReadLink } #49580
pkg io/fs, type ReadLinkFS interface, Lstat(string) (FileInfo, error) #49580
pkg io/fs, type ReadLinkFS interface, Open(string) (File, error) #49580
pkg io/fs, type ReadLinkFS interface, ReadLink(string) (string, error) #49580
pkg testing/fstest, method (MapFS) Lstat(string) (fs.FileInfo, error) #49580
pkg testing/fstest, method (MapFS) ReadLink(string) (string, error) #49580