Mercurial > go > multipass
view file/unix_users.go @ 13:da6c493cf08a
Move Unix-specific user auth files into unix_users.go.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Thu, 29 Oct 2015 21:29:27 -0400 |
parents | file/paths.go@c18bc7b9d1d9 |
children |
line wrap: on
line source
package file import ( "os/user" "path" ) const ( MultipassFile = ".multipass" ) // ForUser gets the given user's ShadowFile. func ForUser(username string) (*ShadowFile, error) { u, err := user.Lookup(username) if err != nil { return nil, err } return New(path.Join(u.HomeDir, MultipassFile)), nil } // ForMe gets the current user's ShadowFile. func ForMe() (*ShadowFile, error) { u, err := user.Current() if err != nil { return nil, err } return New(path.Join(u.HomeDir, MultipassFile)), nil }