Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion user/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/moby/sys/user

go 1.18
go 1.24

require golang.org/x/sys v0.1.0

Expand Down
5 changes: 2 additions & 3 deletions user/idtools_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package user
import (
"errors"
"fmt"
"maps"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -292,9 +293,7 @@ func readTree(base, root string) (map[string]node, error) {
if err != nil {
return nil, err
}
for path, nodeinfo := range subtree {
tree[path] = nodeinfo
}
maps.Copy(tree, subtree)
}
}
return tree, nil
Expand Down
8 changes: 2 additions & 6 deletions user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io"
"os"
"slices"
"strconv"
"strings"
)
Expand Down Expand Up @@ -352,12 +353,7 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) (
// If the group argument isn't explicit, we'll just search for it.
if groupArg == nil {
// Check if user is a member of this group.
for _, u := range g.List {
if u == matchedUserName {
return true
}
}
return false
return slices.Contains(g.List, matchedUserName)
}
return groupArg.matches(g)
})
Expand Down
Loading