cmd, node: dump empty value config (#21296)

This commit is contained in:
gary rong
2020-07-07 04:09:30 +08:00
committed by GitHub
parent 6315b6fcc0
commit 6d8e51ab88
2 changed files with 14 additions and 11 deletions

View File

@ -905,12 +905,15 @@ func setNAT(ctx *cli.Context, cfg *p2p.Config) {
// splitAndTrim splits input separated by a comma
// and trims excessive white space from the substrings.
func splitAndTrim(input string) []string {
result := strings.Split(input, ",")
for i, r := range result {
result[i] = strings.TrimSpace(r)
func splitAndTrim(input string) (ret []string) {
l := strings.Split(input, ",")
for _, r := range l {
r = strings.TrimSpace(r)
if len(r) > 0 {
ret = append(ret, r)
}
}
return result
return ret
}
// setHTTP creates the HTTP RPC listener interface string from the set