-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed as not planned
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal
Milestone
Description
Proposal Details
Extend type os.Root by implementing interface io/fs.SubFS.
The implementation is almost trivial as os.Root already has an OpenRoot method:
func (rfs *rootFS) Sub(dir string) (fs.FS, error) {
if !isValidRootFSPath(dir) {
return nil, &PathError{Op: "sub", Path: dir, Err: ErrInvalid}
}
r, err := (*Root)(rfs).OpenRoot(dir)
if err != nil {
return nil, err
}
return r.FS(), nil
}
var _ fs.SubFS = (*rootFS)(nil)The documentation of os.Root.FS() will be extend to link to fs.SubFS.
apparentlymart
Metadata
Metadata
Assignees
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal
Type
Projects
Status
Declined