changeset 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 1c194fa9bbf4
children 4368a377ff64
files file/file.go file/paths.go file/unix_users.go
diffstat 3 files changed, 28 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- 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 {
--- 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"
-)
--- /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
+}