From 9bd4165f72490caf56160788418b964b87961630 Mon Sep 17 00:00:00 2001 From: Matthew Halpern Date: Thu, 14 Feb 2019 13:45:05 -0800 Subject: [PATCH] accounts/*: prefer nil slices over zero-length slices --- accounts/keystore/keystore.go | 6 ++++-- accounts/usbwallet/hub.go | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/accounts/keystore/keystore.go b/accounts/keystore/keystore.go index 2918047ccd..434e035048 100644 --- a/accounts/keystore/keystore.go +++ b/accounts/keystore/keystore.go @@ -137,8 +137,10 @@ func (ks *KeyStore) refreshWallets() { accs := ks.cache.accounts() // Transform the current list of wallets into the new one - wallets := make([]accounts.Wallet, 0, len(accs)) - events := []accounts.WalletEvent{} + var ( + wallets = make([]accounts.Wallet, 0, len(accs)) + events []accounts.WalletEvent + ) for _, account := range accs { // Drop wallets while they were in front of the next account diff --git a/accounts/usbwallet/hub.go b/accounts/usbwallet/hub.go index 640320bc91..a91340b4fc 100644 --- a/accounts/usbwallet/hub.go +++ b/accounts/usbwallet/hub.go @@ -150,8 +150,10 @@ func (hub *Hub) refreshWallets() { // Transform the current list of wallets into the new one hub.stateLock.Lock() - wallets := make([]accounts.Wallet, 0, len(devices)) - events := []accounts.WalletEvent{} + var ( + wallets = make([]accounts.Wallet, 0, len(devices)) + events []accounts.WalletEvent + ) for _, device := range devices { url := accounts.URL{Scheme: hub.scheme, Path: device.Path}