-
Notifications
You must be signed in to change notification settings - Fork 534
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
Client.OptionsReader() returns a struct ClientOptionsReader instead of interface which make mocking impossible #661
Comments
I've never had the need to use I can see two ways of resolving this:
I agree that your solution is the cleanest, however it's also potentially a breaking change, so the second method might be simpler (provides the functionality you need without any potential to break others code). While the first change is potentially breaking I doubt that many (any?) users are actually using this in a way that would be broken so am open to being convinced that this is the right way to go (but really don't want to have to release a |
Thanks for the fast response! If i find some free time I can try to implement a solution and make a PR. |
OK - which method where you thinking of going with? (I'd accept a PR utilising the second option without much thought; if you change the |
I'd chose the second option if you think that's less risky then. |
This MR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/eclipse/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang) | require | minor | `v1.4.3` -> `v1.5.0` | --- ### Release Notes <details> <summary>eclipse/paho.mqtt.golang (github.com/eclipse/paho.mqtt.golang)</summary> ### [`v1.5.0`](https://github.com/eclipse/paho.mqtt.golang/releases/tag/v1.5.0) [Compare Source](eclipse-paho/paho.mqtt.golang@v1.4.3...v1.5.0) In the year since the release of v1.4.3 the majority of changes have been small incremental improvements/fixes. One notable change is that Go v1.20+ is now required (due to MR [#​646](eclipse-paho/paho.mqtt.golang#646)). #### What's Changed - Wrap connection network errors by [@​adriansmares](https://github.com/adriansmares) in eclipse-paho/paho.mqtt.golang#646 - Clarify use of token.WaitTimeout by [@​MattBrittan](https://github.com/MattBrittan) in eclipse-paho/paho.mqtt.golang#659 - fix ([#​661](eclipse-paho/paho.mqtt.golang#661)): Add NewClientOptionsReader for mocking purposes. by [@​avmunm](https://github.com/avmunm) in eclipse-paho/paho.mqtt.golang#662 - fix: fix keep-alive timeouts on small intervals by [@​lefinal](https://github.com/lefinal) in eclipse-paho/paho.mqtt.golang#667 - Replace the time.After with the timer for efficiency. by [@​DVasselli](https://github.com/DVasselli) in eclipse-paho/paho.mqtt.golang#671 - fix: deprecation warnings for ioutil by [@​vruge](https://github.com/vruge) in eclipse-paho/paho.mqtt.golang#665 - fix: issue 675:goroutine leak when connectionUp(true) return error by [@​kiqi007](https://github.com/kiqi007) in eclipse-paho/paho.mqtt.golang#678 - Update dependencies by [@​MattBrittan](https://github.com/MattBrittan) in eclipse-paho/paho.mqtt.golang#683 #### New Contributors - [@​adriansmares](https://github.com/adriansmares) made their first contribution in eclipse-paho/paho.mqtt.golang#646 - [@​avmunm](https://github.com/avmunm) made their first contribution in eclipse-paho/paho.mqtt.golang#662 - [@​lefinal](https://github.com/lefinal) made their first contribution in eclipse-paho/paho.mqtt.golang#667 - [@​DVasselli](https://github.com/DVasselli) made their first contribution in eclipse-paho/paho.mqtt.golang#671 - [@​vruge](https://github.com/vruge) made their first contribution in eclipse-paho/paho.mqtt.golang#665 - [@​kiqi007](https://github.com/kiqi007) made their first contribution in eclipse-paho/paho.mqtt.golang#678 **Full Changelog**: eclipse-paho/paho.mqtt.golang@v1.4.3...v1.5.0 </details> --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119--> See merge request alpine/infra/build-server-status!15
Hi,
Client.OptionsReader returns this object.
When trying to mock the Client and using the options reader in my applications I get a nilpointer, as I can only return an empty struct of
ClientOptionsReader
. I think it would be better if ClientOptionsReader was an interface, so I could also mock it.Unless I am missing something else I could do?
Going from this:
To this:
The text was updated successfully, but these errors were encountered: