Proposal Details
When dealing with os.Root, a need arises to pass it around to goroutines doing things. To simplify the lifecycle management, it will be the best to have an ability to duplicate the os.Root via a proper file descriptor duplication method, so each goroutine can close its own instance of os.Root when it's done.
In the meantime, duplication via OpenRoot(".") is available. Unfortunately, successive duplication don't carry the same name:
r1, _ := os.OpenRoot("/my/dir")
// r1.Name() == "/my/dir"
r2, _ := r1.OpenRoot(".")
// r2.Name() == "/my/dir/."
r3, _ := r2.OpenRoot(".")
// r3.Name() == "/my/dir/./."
One can, of course, always use filepath.Clean on the name returned, but then, so can the OpenRoot method internally.
Proposal Details
When dealing with
os.Root, a need arises to pass it around to goroutines doing things. To simplify the lifecycle management, it will be the best to have an ability to duplicate theos.Rootvia a proper file descriptor duplication method, so each goroutine can close its own instance ofos.Rootwhen it's done.In the meantime, duplication via
OpenRoot(".")is available. Unfortunately, successive duplication don't carry the same name:One can, of course, always use
filepath.Cleanon the name returned, but then, so can theOpenRootmethod internally.