Browse Source

pretty print addrbook json

pull/9/head
Jae Kwon 11 years ago
parent
commit
1603d6f385
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      p2p/addrbook.go

+ 3
- 3
p2p/addrbook.go View File

@ -305,11 +305,11 @@ func (a *AddrBook) saveToFile(filePath string) {
log.Error("Error opening file: ", filePath, err)
return
}
enc := json.NewEncoder(w)
defer w.Close()
err = enc.Encode(&aJSON)
jsonBytes, err := json.MarshalIndent(aJSON, "", "\t")
_, err = w.Write(jsonBytes)
if err != nil {
panic(err)
log.Error("Failed to save AddrBook to file %v: %v", filePath, err)
}
}


Loading…
Cancel
Save