rename ID to Id

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-06-28 16:17:52 -04:00 committed by Jakub
parent b43f954785
commit b4e01ef892
2 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import "fmt"
type Peer struct {
Enode string `json:"enode"`
Id peerId `json:"id"`
ID PeerId `json:"id"`
Name string `json:"name"`
Caps []string `json:"caps"`
Network NetworkInfo `json:"network"`
@ -12,13 +12,13 @@ type Peer struct {
}
func (p Peer) String() string {
return fmt.Sprintf("Peer(id=%s)", p.Id)
return fmt.Sprintf("Peer(ID=%s)", p.ID)
}
type peerId string
type PeerId string
// the ID is too long to display in full in most places
func (id peerId) String() string {
func (id PeerId) String() string {
return fmt.Sprintf("%s...%s",
string(id[:6]),
string(id[len(id)-6:]))

View File

@ -47,7 +47,7 @@ func renderPeerInfo(g *gocui.Gui, peer *Peer) {
v.Clear()
fmt.Fprintf(v, strings.Repeat("%-8s: %v\n", 8),
"Name", peer.Name,
"ID", string(peer.Id),
"ID", string(peer.ID),
"Enode", peer.Enode,
"Static", peer.Network.Static,
"Trusted", peer.Network.Trusted,
@ -76,9 +76,9 @@ func updatePeerCursor(g *gocui.Gui, current int) {
func (p Peer) AsTable(maxWidth int) string {
var id string
if maxWidth > 160 {
id = string(p.Id)
id = string(p.ID)
} else {
id = p.Id.String()
id = p.ID.String()
}
return fmt.Sprintf("%s %-15s %-21s %-7s %-8s",
id, p.Name,