user

package
v0.0.0-...-2fcdcd3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidUserDatabaseError = errors.New("invalid user database")

Functions

This section is empty.

Types

type UnknownUserError

type UnknownUserError string

UnknownUserError is returned by Lookup when a user cannot be found in the "/etc/passwd" password file.

func (UnknownUserError) Error

func (e UnknownUserError) Error() string

type UnknownUserIdError

type UnknownUserIdError int

UnknownUserIdError is returned by LookupId when a user cannot be found in the "/etc/passwd" password file.

func (UnknownUserIdError) Error

func (e UnknownUserIdError) Error() string

type User

type User struct {
	Username string
	Uid      string
	Gid      string
	Name     string
	HomeDir  string
}

User represents a unix user account found in the "/etc/passwd" password file.

func Current

func Current() (*User, error)

Current returns the current user. Returns UnknownUserIdError if the user cannot be found.

func Lookup

func Lookup(username string) (*User, error)

Lookup looks up a user by username. Returns UnknownUserError if the user cannot be found.

func LookupId

func LookupId(uid string) (*User, error)

LookupId looks up a user by userid. Returns UnknownUserIdError if the user cannot be found.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL