From b322073f27b0e9e60b2ab07eff7f4e96a24cb3f9 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Wed, 17 Dec 2014 01:39:09 +1100 Subject: [PATCH] user: *: fix function signatures This patch changes the incorrectly named functions GetPasswdFile, GetGroupFile, GetExecUserFile and several internal components to GetPasswdPath, GetGroupPath, etc -- as these are far more appropriate names and more clearly convey to users what the arguments represent. Signed-off-by: Aleksa Sarai (github: cyphar) --- user/lookup_unix.go | 16 ++++++++-------- user/lookup_unsupported.go | 4 ++-- user/user.go | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/user/lookup_unix.go b/user/lookup_unix.go index 409c114e2..758b734c2 100644 --- a/user/lookup_unix.go +++ b/user/lookup_unix.go @@ -9,22 +9,22 @@ import ( // Unix-specific path to the passwd and group formatted files. const ( - unixPasswdFile = "/etc/passwd" - unixGroupFile = "/etc/group" + unixPasswdPath = "/etc/passwd" + unixGroupPath = "/etc/group" ) -func GetPasswdFile() (string, error) { - return unixPasswdFile, nil +func GetPasswdPath() (string, error) { + return unixPasswdPath, nil } func GetPasswd() (io.ReadCloser, error) { - return os.Open(unixPasswdFile) + return os.Open(unixPasswdPath) } -func GetGroupFile() (string, error) { - return unixGroupFile, nil +func GetGroupPath() (string, error) { + return unixGroupPath, nil } func GetGroup() (io.ReadCloser, error) { - return os.Open(unixGroupFile) + return os.Open(unixGroupPath) } diff --git a/user/lookup_unsupported.go b/user/lookup_unsupported.go index 0f15c57d8..721794887 100644 --- a/user/lookup_unsupported.go +++ b/user/lookup_unsupported.go @@ -4,7 +4,7 @@ package user import "io" -func GetPasswdFile() (string, error) { +func GetPasswdPath() (string, error) { return "", ErrUnsupported } @@ -12,7 +12,7 @@ func GetPasswd() (io.ReadCloser, error) { return nil, ErrUnsupported } -func GetGroupFile() (string, error) { +func GetGroupPath() (string, error) { return "", ErrUnsupported } diff --git a/user/user.go b/user/user.go index 69387f2ef..d7439f12e 100644 --- a/user/user.go +++ b/user/user.go @@ -197,11 +197,11 @@ type ExecUser struct { Home string } -// GetExecUserFile is a wrapper for GetExecUser. It reads data from each of the +// GetExecUserPath is a wrapper for GetExecUser. It reads data from each of the // given file paths and uses that data as the arguments to GetExecUser. If the // files cannot be opened for any reason, the error is ignored and a nil // io.Reader is passed instead. -func GetExecUserFile(userSpec string, defaults *ExecUser, passwdPath, groupPath string) (*ExecUser, error) { +func GetExecUserPath(userSpec string, defaults *ExecUser, passwdPath, groupPath string) (*ExecUser, error) { passwd, err := os.Open(passwdPath) if err != nil { passwd = nil