-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add os.Root, a type which represents a directory and permits performing file operations within that directory. For #67002 Change-Id: I863f4f1bc320a89b1125ae4237761f3e9320a901 Reviewed-on: https://go-review.googlesource.com/c/go/+/612136 Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Quim Muntal <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
- Loading branch information
Showing
17 changed files
with
2,243 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pkg os, func OpenRoot(string) (*Root, error) #67002 | ||
pkg os, method (*Root) Close() error #67002 | ||
pkg os, method (*Root) Create(string) (*File, error) #67002 | ||
pkg os, method (*Root) Mkdir(string, fs.FileMode) error #67002 | ||
pkg os, method (*Root) Name() string #67002 | ||
pkg os, method (*Root) Open(string) (*File, error) #67002 | ||
pkg os, method (*Root) OpenFile(string, int, fs.FileMode) (*File, error) #67002 | ||
pkg os, method (*Root) OpenRoot(string) (*Root, error) #67002 | ||
pkg os, type Root struct #67002 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
### Directory-limited filesystem access | ||
|
||
<!-- go.dev/issue/67002 --> | ||
The new [os.Root] type provides the ability to perform filesystem | ||
operations within a specific directory. | ||
|
||
The [os.OpenRoot] function opens a directory and returns an [os.Root]. | ||
Methods on [os.Root] operate within the directory and do not permit | ||
paths that refer to locations outside the directory, including | ||
ones that follow symbolic links out of the directory. | ||
|
||
- [os.Root.Open] opens a file for reading. | ||
- [os.Root.Create] creates a file. | ||
- [os.Root.OpenFile] is the generalized open call. | ||
- [os.Root.Mkdir] creates a directory. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!-- os.Root --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.