libp2p / go-libp2p-pubsub

The PubSub implementation for go-libp2p
https://github.com/libp2p/specs/tree/master/pubsub
Other
321 stars 185 forks source link

pubsub.Topic should satisfy fmt.Stringer #358

Closed lthibault closed 4 years ago

lthibault commented 4 years ago

Due to the requirement of maintaining a single *pubsub.Topic handle per pubsub topic, it is often helpful to identify the topic to which a given handle belongs.

Common solutions include:

Seeing as how *topic.Topic already contains an unexported topic field, it would be both trivial and extremely helpful to add the following method:

func (t *Topic) String() string {
    return t.topic
}

I'm happy to submit a PR if there's any interest.

aschmahmann commented 4 years ago

Sounds great, was one of the suggestions here (https://github.com/libp2p/go-libp2p-pubsub/issues/198#issuecomment-548896902) that has yet to be implemented.

Would welcome a PR.

lthibault commented 4 years ago

@aschmahmann Done! Please see #370.