Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pubsub.Topic should satisfy fmt.Stringer #358

Closed
lthibault opened this issue Jul 15, 2020 · 2 comments · Fixed by #370
Closed

pubsub.Topic should satisfy fmt.Stringer #358

lthibault opened this issue Jul 15, 2020 · 2 comments · Fixed by #370

Comments

@lthibault
Copy link
Contributor

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:

  • map[string]*topic.Topic
  • Defining a local topic handle that embeds *topic.Topic, and exposes the topic string via a String() string method

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
Copy link
Contributor

Sounds great, was one of the suggestions here (#198 (comment)) that has yet to be implemented.

Would welcome a PR.

@lthibault
Copy link
Contributor Author

@aschmahmann Done! Please see #370.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants