|
|
|
|
|
by flkenosad
990 days ago
|
|
Is the new std lib a re-implementation of the existing std lib or are you defining brand new interfaces as well? For example, will you still have an `os.WriteFile` and will its still take the same parameters and return the same results? |
|
And Yes, we are defining brand new interfaces as well, in order to improve usability and fix inconsistent user experience.
For your specific example `os.WriteFile` (names mentioned below may subject to change):
The api won't make it inside the std, because the local filesystem will be implemented as a `fs.FS` (concrete type `*sysfs.FS`), so you can have multiple `sysfs.FS` instances each at its own working directory, and the `os.WriteFile` will be replaced with `fs.WriteFile(fsys fs.FS, path *fs.PathBuf, wctx *io.WriteContext) io.Status`, where `fs.PathBuf` is our solution to handle all kinds of path styles (windows, unix, cygwin, utf8, utf16, end-null) and operations (join, base, dir).