aboutsummaryrefslogtreecommitdiff
path: root/actions/context.go
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-11-27 11:40:47 -0800
committerEric Biggers <ebiggers@google.com>2019-11-27 11:40:47 -0800
commit03d3a29b70c85f083adf3c12cba60c0374f06d3e (patch)
tree0fac2f6e457809d9c49026336d391bec7289a6b0 /actions/context.go
parent82d01438a66212ce802721397a62c18a0b71b7ea (diff)
Rename some variables from 'target' to 'targetUser'
Refer to the target User as 'targetUser' rather than simply 'target'. This will help avoid confusion when we add support for the filesystem keyring, since then the Mount will also be a "target".
Diffstat (limited to 'actions/context.go')
-rw-r--r--actions/context.go30
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
}