aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Halpern <matthalp@google.com>2019-03-06 18:30:39 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-03-06 18:30:39 +0800
commit15eee47ebf878b4eff3c2359b9eaa57bba397448 (patch)
tree1baf052191da5d40739e0883aad9f0b19d768087
parent34c85def3eec09ee50ea2499824aeaa48705eae2 (diff)
downloadgo-tangerine-15eee47ebf878b4eff3c2359b9eaa57bba397448.tar
go-tangerine-15eee47ebf878b4eff3c2359b9eaa57bba397448.tar.gz
go-tangerine-15eee47ebf878b4eff3c2359b9eaa57bba397448.tar.bz2
go-tangerine-15eee47ebf878b4eff3c2359b9eaa57bba397448.tar.lz
go-tangerine-15eee47ebf878b4eff3c2359b9eaa57bba397448.tar.xz
go-tangerine-15eee47ebf878b4eff3c2359b9eaa57bba397448.tar.zst
go-tangerine-15eee47ebf878b4eff3c2359b9eaa57bba397448.zip
accounts: prefer nil slices over zero-length slices (#19079)
-rw-r--r--accounts/keystore/keystore.go6
-rw-r--r--accounts/usbwallet/hub.go6
2 files changed, 8 insertions, 4 deletions
diff --git a/accounts/keystore/keystore.go b/accounts/keystore/keystore.go
index 2918047cc..434e03504 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 640320bc9..a91340b4f 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}