spali / go-rscp

Go library to communicate with a E3DC system implementing the RSCP (Remote Storage Control Protocol)
https://github.com/spali/go-rscp
MIT License
27 stars 9 forks source link

Inconsistent Send vs SendMultiple vs NewMessage #69

Open andig opened 2 days ago

andig commented 2 days ago

While Send takes a Message it returns a *Message. Send uses SendMultiple which works on Message only. Internally, receive works on Messages only. I suggest to change the Send signature to return a Message and modify NewMessage accordingly.

andig commented 16 hours ago

An alternative approach would of course be to use pointer to message consistently throughout. That would make for simpler error return values (nil instead of Message{}).

spali commented 7 hours ago

Hm... good point. Still thinking ... to be honest I tend to like pointer everywhere more. Both would be breaking changes, but I assume expect you only the cmd utility is used by others (at least as I know).

andig commented 7 hours ago

I know the difference had caused me quite a bit of confusion. I‘d be happy either way.

spali commented 6 hours ago

Thanks for the issue and PR... have to find time to do it the pointer way, but doesn't hurry for now.