Skip to content

Commit 15eee47

Browse files
Matthalp-zzkaralabe
authored andcommitted
accounts: prefer nil slices over zero-length slices (#19079)
1 parent 34c85de commit 15eee47

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎accounts/keystore/keystore.go‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ func (ks *KeyStore) refreshWallets() {
137137
accs := ks.cache.accounts()
138138

139139
// Transform the current list of wallets into the new one
140-
wallets := make([]accounts.Wallet, 0, len(accs))
141-
events := []accounts.WalletEvent{}
140+
var (
141+
wallets = make([]accounts.Wallet, 0, len(accs))
142+
events []accounts.WalletEvent
143+
)
142144

143145
for _, account := range accs {
144146
// Drop wallets while they were in front of the next account

‎accounts/usbwallet/hub.go‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ func (hub *Hub) refreshWallets() {
150150
// Transform the current list of wallets into the new one
151151
hub.stateLock.Lock()
152152

153-
wallets := make([]accounts.Wallet, 0, len(devices))
154-
events := []accounts.WalletEvent{}
153+
var (
154+
wallets = make([]accounts.Wallet, 0, len(devices))
155+
events []accounts.WalletEvent
156+
)
155157

156158
for _, device := range devices {
157159
url := accounts.URL{Scheme: hub.scheme, Path: device.Path}

0 commit comments

Comments
 (0)