# HG changeset patch # User Paul Fisher # Date 1446168567 14400 # Node ID da6c493cf08a712787304c28cfffdd90e388b07f # Parent 1c194fa9bbf4867ae7305ab902747ef3cada3b72 Move Unix-specific user auth files into unix_users.go. diff -r 1c194fa9bbf4 -r da6c493cf08a file/file.go --- a/file/file.go Thu Oct 29 21:25:12 2015 -0400 +++ b/file/file.go Thu Oct 29 21:29:27 2015 -0400 @@ -10,8 +10,6 @@ "bufio" "errors" "os" - "os/user" - "path" "syscall" "time" @@ -33,24 +31,6 @@ name string } -// 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 -} - // New creates a ShadowFile for reading at the given path. // If a file needs to be created, uses the given GID to create it. func New(name string) *ShadowFile { diff -r 1c194fa9bbf4 -r da6c493cf08a file/paths.go --- a/file/paths.go Thu Oct 29 21:25:12 2015 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -package file - -const ( - MultipassFile = ".multipass" -) diff -r 1c194fa9bbf4 -r da6c493cf08a file/unix_users.go --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/file/unix_users.go Thu Oct 29 21:29:27 2015 -0400 @@ -0,0 +1,28 @@ +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 +}