Skip to content

[WIP] user: GetExecUser: rewrite with parseUserArg, parseGroupArg#231

Draft
thaJeztah wants to merge 2 commits into
moby:mainfrom
thaJeztah:refactor_user
Draft

[WIP] user: GetExecUser: rewrite with parseUserArg, parseGroupArg#231
thaJeztah wants to merge 2 commits into
moby:mainfrom
thaJeztah:refactor_user

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

Use a similar approach as was applied to GetAdditionalGroups in 6eb9f15

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Comment thread user/user.go
Comment on lines +396 to +407
// userArg is a parsed user argument for [GetExecUser].
type userArg struct {
name string
uid int
isNumeric bool
}

// parseUserArg parses a user argument as either a user name or UID.
//
// If name is empty, parseUserArg returns "nil, nil" to indicate that no user
// argument was specified.
func parseUserArg(name string) (*userArg, error) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering if we should move all these utilities to user_utils.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant