Skip to content

Commit

Permalink
libct/user: rm windows code
Browse files Browse the repository at this point in the history
Commit bf74951 added these two functions, but they are only used from
Windows code. The v1 of this patch moved these functions to _windows.go
file, but after some discussion we decided to drop windows code
altogether, so this is what this patch now does.

This fixes

> libcontainer/user/user.go:64:6: func `groupFromOS` is unused (unused)
> libcontainer/user/user.go:35:6: func `userFromOS` is unused (unused)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin authored and thaJeztah committed Apr 2, 2021
1 parent 0596f6e commit 2515b0c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 80 deletions.
40 changes: 0 additions & 40 deletions libcontainer/user/lookup_windows.go

This file was deleted.

40 changes: 0 additions & 40 deletions libcontainer/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"io"
"os"
"os/user"
"strconv"
"strings"
)
Expand All @@ -29,52 +28,13 @@ type User struct {
Shell string
}

// userFromOS converts an os/user.(*User) to local User
//
// (This does not include Pass, Shell or Gecos)
func userFromOS(u *user.User) (User, error) {
newUser := User{
Name: u.Username,
Home: u.HomeDir,
}
id, err := strconv.Atoi(u.Uid)
if err != nil {
return newUser, err
}
newUser.Uid = id

id, err = strconv.Atoi(u.Gid)
if err != nil {
return newUser, err
}
newUser.Gid = id
return newUser, nil
}

type Group struct {
Name string
Pass string
Gid int
List []string
}

// groupFromOS converts an os/user.(*Group) to local Group
//
// (This does not include Pass or List)
func groupFromOS(g *user.Group) (Group, error) {
newGroup := Group{
Name: g.Name,
}

id, err := strconv.Atoi(g.Gid)
if err != nil {
return newGroup, err
}
newGroup.Gid = id

return newGroup, nil
}

// SubID represents an entry in /etc/sub{u,g}id
type SubID struct {
Name string
Expand Down

0 comments on commit 2515b0c

Please sign in to comment.