Skip to content

Commit 061a1e8

Browse files
committed
Gossip/discovery: add String() to NetworkMember
This commit simply adds a String() method to NetworkMember, because otherwise- the struct is printed without its field names and it's hard to figure out which refers to what. Change-Id: I5ea6552b79afa21b3222ebe1b7b22349851b653a Signed-off-by: Yacov Manevich <[email protected]>
1 parent b3d3254 commit 061a1e8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gossip/discovery/discovery.go

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package discovery
1818

1919
import (
20+
"fmt"
21+
2022
"github.com/hyperledger/fabric/gossip/common"
2123
proto "github.com/hyperledger/fabric/protos/gossip"
2224
)
@@ -80,6 +82,11 @@ type NetworkMember struct {
8082
InternalEndpoint string
8183
}
8284

85+
// String returns a string representation of the NetworkMember
86+
func (n *NetworkMember) String() string {
87+
return fmt.Sprintf("Endpoint: %s, InternalEndpoint: %s, PKI-ID: %v, Metadata: %v", n.Endpoint, n.InternalEndpoint, n.PKIid, n.Metadata)
88+
}
89+
8390
// PreferredEndpoint computes the endpoint to connect to,
8491
// while preferring internal endpoint over the standard
8592
// endpoint

0 commit comments

Comments
 (0)