Skip to content

proposal: os/user: include shell in user lookup #59121

@kdrag0n

Description

@kdrag0n

On unix systems, user.Lookup returns most passwd fields, but not shell:

u := &User{
Username: parts[0],
Uid: parts[2],
Gid: parts[3],
Name: parts[4],
HomeDir: parts[5],
}

It can be desired to look up a user's shell in some cases, and it should be a small non-intrusive change:

  • Add a Shell string field to user.User.
  • For the Cgo case, read pw_shell from the passwd struct
  • For the non-Cgo case, read parts[6]
  • Leave the field blank on Windows systems

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions