-
Notifications
You must be signed in to change notification settings - Fork 115
Description
I am reading the godoc and notice that the library defines the interfaces Conn and Subscription. The idea with interfaces in Go is that they generally should be defined by the user of a library, not the library author. See this and this answers from one of the most influential Go developers out there. The current approach of defining interfaces, and having Connect(...) return a Conn.
On a practical level, if https://godoc.org/github.com/nats-io/go-nats-streaming#Connect had returned an actual (public) implementation I would be able to click on Conn.Publish(subject string, data []byte) error and end up in the actual implementation. This would allow me to much quicker understand how something works.
Given the above, I propose removing the Conn interface and instead renaming the conn implementation to Conn. The same applies to Subscription. I understand that it's a small non-backwards compatible change, but will 1) remove one unnecessary level of abstraction and 2) people relying on the interface can easily define it themselves.