rpc: return a slice of strings, simpler and equivalent

Signed-off-by: meows <b5c6@protonmail.com>
This commit is contained in:
meows 2019-12-18 09:05:06 -06:00
parent fb6453db1d
commit 9b8f5cc143
No known key found for this signature in database
GPG key ID: 5786AEA5C8D5A520

View file

@ -18,7 +18,6 @@ package rpc
import ( import (
"net" "net"
"strings"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
) )
@ -33,8 +32,7 @@ func mustAvailableModule(module string, apis []API) {
return return
} }
} }
log.Crit("invalid api module", "module", module, "available", func() string { log.Crit("invalid api module", "module", module, "available", func() (available []string) {
available := []string{}
outer: outer:
for _, api := range apis { for _, api := range apis {
// Only include unique api names // Only include unique api names
@ -45,7 +43,7 @@ func mustAvailableModule(module string, apis []API) {
} }
available = append(available, api.Namespace) available = append(available, api.Namespace)
} }
return strings.Join(available, ",") return
}()) }())
} }