aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
authorMatthew Halpern <matthalp@google.com>2019-02-15 07:02:11 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-02-15 07:02:11 +0800
commitfa87929a2fbed11c614d57d43cd64ced15ba80b8 (patch)
tree981deee9159b1489efb5eb97fd9f1707876d5768 /cmd/geth
parente26a119c9b83e816a8ce9b0afdd6f2c82e61062d (diff)
downloadgo-tangerine-fa87929a2fbed11c614d57d43cd64ced15ba80b8.tar
go-tangerine-fa87929a2fbed11c614d57d43cd64ced15ba80b8.tar.gz
go-tangerine-fa87929a2fbed11c614d57d43cd64ced15ba80b8.tar.bz2
go-tangerine-fa87929a2fbed11c614d57d43cd64ced15ba80b8.tar.lz
go-tangerine-fa87929a2fbed11c614d57d43cd64ced15ba80b8.tar.xz
go-tangerine-fa87929a2fbed11c614d57d43cd64ced15ba80b8.tar.zst
go-tangerine-fa87929a2fbed11c614d57d43cd64ced15ba80b8.zip
cmd: prefer nil slices over zero-length slices (#19077)
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/monitorcmd.go6
-rw-r--r--cmd/geth/usage.go2
2 files changed, 4 insertions, 4 deletions
diff --git a/cmd/geth/monitorcmd.go b/cmd/geth/monitorcmd.go
index e4ba96a7a..34e090e1e 100644
--- a/cmd/geth/monitorcmd.go
+++ b/cmd/geth/monitorcmd.go
@@ -169,7 +169,7 @@ func retrieveMetrics(client *rpc.Client) (map[string]interface{}, error) {
// resolveMetrics takes a list of input metric patterns, and resolves each to one
// or more canonical metric names.
func resolveMetrics(metrics map[string]interface{}, patterns []string) []string {
- res := []string{}
+ var res []string
for _, pattern := range patterns {
res = append(res, resolveMetric(metrics, pattern, "")...)
}
@@ -179,7 +179,7 @@ func resolveMetrics(metrics map[string]interface{}, patterns []string) []string
// resolveMetrics takes a single of input metric pattern, and resolves it to one
// or more canonical metric names.
func resolveMetric(metrics map[string]interface{}, pattern string, path string) []string {
- results := []string{}
+ var results []string
// If a nested metric was requested, recurse optionally branching (via comma)
parts := strings.SplitN(pattern, "/", 2)
@@ -215,7 +215,7 @@ func resolveMetric(metrics map[string]interface{}, pattern string, path string)
// expandMetrics expands the entire tree of metrics into a flat list of paths.
func expandMetrics(metrics map[string]interface{}, path string) []string {
// Iterate over all fields and expand individually
- list := []string{}
+ var list []string
for name, metric := range metrics {
switch metric := metric.(type) {
case float64:
diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go
index 0b5c6fd90..a26203716 100644
--- a/cmd/geth/usage.go
+++ b/cmd/geth/usage.go
@@ -308,7 +308,7 @@ func init() {
categorized[flag.String()] = struct{}{}
}
}
- uncategorized := []cli.Flag{}
+ var uncategorized []cli.Flag
for _, flag := range data.(*cli.App).Flags {
if _, ok := categorized[flag.String()]; !ok {
if strings.HasPrefix(flag.GetName(), "dashboard") {