Skip to content

Commit 12999ac

Browse files
committed
PR feedback
Signed-off-by: Grant Linville <[email protected]>
1 parent d2442f4 commit 12999ac

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: pkg/credentials/store.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ func (s Store) Get(ctx context.Context, toolName string) (*Credential, bool, err
9696
}
9797

9898
func (s Store) Add(ctx context.Context, cred Credential) error {
99-
if first(s.credCtxs) == AllCredentialContexts {
99+
first := first(s.credCtxs)
100+
if first == AllCredentialContexts {
100101
return fmt.Errorf("cannot add a credential with context %q", AllCredentialContexts)
101102
}
102-
cred.Context = first(s.credCtxs)
103+
cred.Context = first
104+
103105
store, err := s.getStore(ctx)
104106
if err != nil {
105107
return err
@@ -112,7 +114,8 @@ func (s Store) Add(ctx context.Context, cred Credential) error {
112114
}
113115

114116
func (s Store) Remove(ctx context.Context, toolName string) error {
115-
if len(s.credCtxs) > 1 || first(s.credCtxs) == AllCredentialContexts {
117+
first := first(s.credCtxs)
118+
if len(s.credCtxs) > 1 || first == AllCredentialContexts {
116119
return fmt.Errorf("error: credential deletion is not supported when multiple credential contexts are provided")
117120
}
118121

@@ -121,7 +124,7 @@ func (s Store) Remove(ctx context.Context, toolName string) error {
121124
return err
122125
}
123126

124-
return store.Erase(toolNameWithCtx(toolName, first(s.credCtxs)))
127+
return store.Erase(toolNameWithCtx(toolName, first))
125128
}
126129

127130
func (s Store) List(ctx context.Context) ([]Credential, error) {

0 commit comments

Comments
 (0)