diff options
Diffstat (limited to 'actions')
| -rw-r--r-- | actions/context.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/actions/context.go b/actions/context.go index 894d941..5a56789 100644 --- a/actions/context.go +++ b/actions/context.go @@ -66,10 +66,10 @@ type Context struct { // NewContextFromPath makes a context for the filesystem containing the // specified path and whose Config is loaded from the global config file. On -// success, the Context contains a valid Config and Mount. The target defaults -// to the current effective user if none is specified. -func NewContextFromPath(path string, target *user.User) (*Context, error) { - ctx, err := newContextFromUser(target) +// success, the Context contains a valid Config and Mount. The target user +// defaults to the current effective user if none is specified. +func NewContextFromPath(path string, targetUser *user.User) (*Context, error) { + ctx, err := newContextFromUser(targetUser) if err != nil { return nil, err } @@ -84,10 +84,10 @@ func NewContextFromPath(path string, target *user.User) (*Context, error) { // NewContextFromMountpoint makes a context for the filesystem at the specified // mountpoint and whose Config is loaded from the global config file. On -// success, the Context contains a valid Config and Mount. The target defaults -// to the current effective user if none is specified. -func NewContextFromMountpoint(mountpoint string, target *user.User) (*Context, error) { - ctx, err := newContextFromUser(target) +// success, the Context contains a valid Config and Mount. The target user +// defaults to the current effective user if none is specified. +func NewContextFromMountpoint(mountpoint string, targetUser *user.User) (*Context, error) { + ctx, err := newContextFromUser(targetUser) if err != nil { return nil, err } @@ -101,22 +101,22 @@ func NewContextFromMountpoint(mountpoint string, target *user.User) (*Context, e } // newContextFromUser makes a context with the corresponding target user, and -// whose Config is loaded from the global config file. If the target is nil, the -// effective user is used. -func newContextFromUser(target *user.User) (*Context, error) { +// whose Config is loaded from the global config file. If the target user is +// nil, the effective user is used. +func newContextFromUser(targetUser *user.User) (*Context, error) { var err error - if target == nil { - if target, err = util.EffectiveUser(); err != nil { + if targetUser == nil { + if targetUser, err = util.EffectiveUser(); err != nil { return nil, err } } - ctx := &Context{TargetUser: target} + ctx := &Context{TargetUser: targetUser} if ctx.Config, err = getConfig(); err != nil { return nil, err } - log.Printf("creating context for %q", target.Username) + log.Printf("creating context for user %q", targetUser.Username) return ctx, nil } |