scrapli / scrapligo

scrapli, but in go!
MIT License
259 stars 42 forks source link

do we need to create an empty response object in case of a failed acquire privelege? #13

Closed hellt closed 3 years ago

hellt commented 3 years ago

In here you create a response object where only host, port and command fields are populated https://github.com/scrapli/scrapligo/blob/379e44c4b71756b578208c9056b22114eccf1b94/driver/network/sendcommand.go#L13-L16

is there a need for that? Won't nil be enough in that case?

carlmontanari commented 3 years ago

Thats a good question.... so... the reason I did it like this is that we always return a response object in python-land. If the thing is failed we return a response object marked as failed, if it works obv we return a response object that is good.

That is/was at least my thinking... but now that you mention it and I think about it... I think that you are correct that this could just be nil here (and probably in all the other send methods) because this would be more equivalent to us hitting an exception in python and just getting a stack trace. I'll go ahead and fix this and get it pushed shortly :) Good call!

carlmontanari commented 3 years ago

Change made here. I think this looks nicer, what do ya think?

hellt commented 3 years ago

yes, thanks!

On Tue, May 25, 2021 at 4:03 PM Carl Montanari @.***> wrote:

Change made here https://github.com/scrapli/scrapligo/commit/8a87b1273735fa44cdb3c321e74b02a14894491e. I think this looks nicer, what do ya think?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/scrapli/scrapligo/issues/13#issuecomment-847897375, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLKV5JY4GZXZLCA5SNGTK3TPOUZLANCNFSM45O2ZU3A .