This repository was archived by the owner on Nov 9, 2019. It is now read-only.
File tree 4 files changed +6
-24
lines changed 4 files changed +6
-24
lines changed Original file line number Diff line number Diff line change @@ -12,21 +12,12 @@ func exportCommand(args ...string) int {
12
12
return handleError (err )
13
13
}
14
14
15
- accounts , err := safe .List ()
16
- if err != nil {
17
- return handleError (err )
18
- }
19
-
15
+ accounts := safe .List ()
20
16
if len (accounts ) < 1 {
21
17
fmt .Println ("No accounts to export" )
22
18
return 1
23
19
}
24
20
25
- var accountSlice []interface {}
26
- for _ , account := range accounts {
27
- accountSlice = append (accountSlice , account )
28
- }
29
-
30
- utils .PrettyPrint (accountSlice )
21
+ utils .PrettyPrint (accounts )
31
22
return 0
32
23
}
Original file line number Diff line number Diff line change @@ -11,13 +11,8 @@ func listCommand(args ...string) int {
11
11
return handleError (err )
12
12
}
13
13
14
- accounts , err := safe .List ()
15
- if err != nil {
16
- return handleError (err )
17
- }
18
-
19
14
var accountNames []string
20
- for _ , account := range accounts {
15
+ for _ , account := range safe . List () {
21
16
accountNames = append (accountNames , account .Name )
22
17
}
23
18
Original file line number Diff line number Diff line change 1
1
package safe
2
2
3
- func (s * Safe ) List () ( []Account , error ) {
3
+ func (s * Safe ) List () []Account {
4
4
var accounts []Account
5
5
for _ , account := range s .Accounts {
6
6
accounts = append (accounts , account )
7
7
}
8
8
9
- return accounts , nil
9
+ return accounts
10
10
}
Original file line number Diff line number Diff line change @@ -16,11 +16,7 @@ func TestList(t *testing.T) {
16
16
t .Error (err )
17
17
}
18
18
19
- accounts , err := safe .List ()
20
- if err != nil {
21
- t .Error (err )
22
- }
23
-
19
+ accounts := safe .List ()
24
20
if len (accounts ) < 1 {
25
21
t .Error (err )
26
22
}
You can’t perform that action at this time.
0 commit comments