user: MkdirAllAndChown, MkdirAndChown: DRY - #244
Open
thaJeztah wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors directory-creation helpers in user/ to reduce duplicated option parsing by forwarding MkdirOpt variadic options directly into the platform-specific mkdirAs implementation.
Changes:
- Simplifies
MkdirAllAndChownandMkdirAndChownto forwardopts ...MkdirOptdirectly tomkdirAs. - Updates
mkdirAs(unix/windows) signatures to acceptopts ...MkdirOptand parses options inside the unix implementation. - Switches unix logic from
onlyNewparameter usage tooptions.onlyNew.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| user/idtools.go | Removes duplicated option parsing in public wrappers by forwarding opts to mkdirAs. |
| user/idtools_windows.go | Updates mkdirAs signature to accept variadic MkdirOpt on Windows. |
| user/idtools_unix.go | Updates mkdirAs signature and moves MkdirOpt parsing into the unix implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
user/idtools_unix.go:29
- The comment below still refers to an
onlyNewboolean parameter, butmkdirAsnow takes variadicMkdirOpts and derivesonlyNewfromoptions.onlyNew. Updating the comment will keep it accurate and avoid confusion about how the behavior is controlled.
if options.onlyNew {
user/idtools_windows.go:9
- Typo in the preceding comment: "could be support here" should be "could be supported here".
func mkdirAs(path string, _ os.FileMode, _, _ int, _ bool, _ ...MkdirOpt) error {
thaJeztah
marked this pull request as ready for review
August 5, 2026 08:07
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.
No description provided.