Repository navigation
Conversation
thaJeztah
force-pushed
the
refactor_mkdirAs
branch
from
September 23, 2026 11:10
d22d1bf to
0810d70
Compare
thaJeztah
force-pushed
the
refactor_mkdirAs
branch
from
October 27, 2026 10:29
0810d70 to
b67c637
Compare
Simplify the implementation by using scoped error variables and a more concise loop for collecting missing parent directories. Rename variables and clarify comments to make it easier to follow which directories receive ownership and permission changes. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah
force-pushed
the
refactor_mkdirAs
branch
from
October 27, 2026 10:34
b67c637 to
895a1b1
Compare
thaJeztah
marked this pull request as ready for review
October 27, 2026 10:35
kolyshkin
reviewed
Oct 28, 2026
| // Track the requested directory and any parent directories created by | ||
| // Mkdir/MkdirAll to set their ownership and permissions afterward. | ||
| var createdDirs []string | ||
| if os.IsNotExist(statErr) { |
Collaborator
There was a problem hiding this comment.
nit: maybe switch to errors.Is while at it.
kolyshkin
reviewed
Oct 28, 2026
Comment on lines
+47
to
+49
| for p := filepath.Dir(path); p != "/"; p = filepath.Dir(p) { | ||
| if _, err := os.Stat(p); os.IsNotExist(err) { | ||
| createdDirs = append(createdDirs, p) |
Collaborator
There was a problem hiding this comment.
I know this is a pre-existing issue, but the logic here is sub-optimal. If a directory exists, there's no need to check its parent, we can break right away.
More to say, we already know if path exists or not, so we can easily skip the whole if mkAll {}.
If you're going to implement it, please do so in a separate commit )
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Simplify the implementation by using scoped error variables and a more concise loop for collecting missing parent directories.
Rename variables and clarify comments to make it easier to follow which directories receive ownership and permission changes.