@@ -16,11 +16,9 @@ func isValidCredsMessage(msg string) error {
16
16
if credentials .IsCredentialsMissingServerURLMessage (msg ) {
17
17
return credentials .NewErrCredentialsMissingServerURL ()
18
18
}
19
-
20
19
if credentials .IsCredentialsMissingUsernameMessage (msg ) {
21
20
return credentials .NewErrCredentialsMissingUsername ()
22
21
}
23
-
24
22
return nil
25
23
}
26
24
@@ -36,13 +34,10 @@ func Store(program ProgramFunc, creds *credentials.Credentials) error {
36
34
37
35
out , err := cmd .Output ()
38
36
if err != nil {
39
- t := strings .TrimSpace (string (out ))
40
-
41
- if isValidErr := isValidCredsMessage (t ); isValidErr != nil {
37
+ if isValidErr := isValidCredsMessage (string (out )); isValidErr != nil {
42
38
err = isValidErr
43
39
}
44
-
45
- return fmt .Errorf ("error storing credentials - err: %v, out: `%s`" , err , t )
40
+ return fmt .Errorf ("error storing credentials - err: %v, out: `%s`" , err , strings .TrimSpace (string (out )))
46
41
}
47
42
48
43
return nil
@@ -55,17 +50,15 @@ func Get(program ProgramFunc, serverURL string) (*credentials.Credentials, error
55
50
56
51
out , err := cmd .Output ()
57
52
if err != nil {
58
- t := strings .TrimSpace (string (out ))
59
-
60
- if credentials .IsErrCredentialsNotFoundMessage (t ) {
53
+ if credentials .IsErrCredentialsNotFoundMessage (string (out )) {
61
54
return nil , credentials .NewErrCredentialsNotFound ()
62
55
}
63
56
64
- if isValidErr := isValidCredsMessage (t ); isValidErr != nil {
57
+ if isValidErr := isValidCredsMessage (string ( out ) ); isValidErr != nil {
65
58
err = isValidErr
66
59
}
67
60
68
- return nil , fmt .Errorf ("error getting credentials - err: %v, out: `%s`" , err , t )
61
+ return nil , fmt .Errorf ("error getting credentials - err: %v, out: `%s`" , err , strings . TrimSpace ( string ( out )) )
69
62
}
70
63
71
64
resp := & credentials.Credentials {
0 commit comments